Neo4j Enterprise features
cvcdocdb targets Neo4j Community Edition, and that is the default mode of
Neo4jGraph. The methods below are only enabled
with Neo4jGraph(..., edition="enterprise").
Warning
They require a valid Neo4j Enterprise license and are not fully tested: CI runs on Neo4j Community only.
Optional Neo4j Enterprise Edition features for Neo4jGraph.
cvcdocdb targets Neo4j Community Edition: that’s what its test suite and
CI run against, and Neo4jGraph defaults to edition="community". In
that mode every method in this module raises EnterpriseFeatureError
without contacting the server.
Passing edition="enterprise" to Neo4jGraph enables them:
create_node_key_constraint()—NODE KEYconstraints (existence + uniqueness of a set of properties).create_property_existence_constraint()—IS NOT NULLconstraints on node or relationship properties.create_property_type_constraint()—IS :: <TYPE>constraints (Neo4j 5.9+).create_database()/drop_database()— multiple user databases.
Warning
Enterprise features require a valid Neo4j Enterprise license (or an
evaluation/developer license accepted under its terms). They are not
fully tested: the regular test suite only checks the generated Cypher
and the Community-mode guards; the tests against a real Enterprise
server run only when NEO4J_ENTERPRISE_URL is set, which CI doesn’t.
None of these constraints is created automatically. In particular a
NODE KEY on a label that cvcdocdb uses with several pk shapes will
reject the nodes of the other shapes — apply it only to labels with a
single pk shape.
- cvcdocdb.neo4j_enterprise.COMMUNITY_EDITION = 'community'
Valid values for
Neo4jGraph(edition=...).
- cvcdocdb.neo4j_enterprise.CONSTRAINT_PREFIX = 'cvcdocdb_'
Prefix of the default constraint names created by this module.
- exception cvcdocdb.neo4j_enterprise.EnterpriseFeatureError[source]
Bases:
RuntimeErrorAn operation needs Neo4j Enterprise Edition, but the graph is in Community mode or the server isn’t Enterprise.
- cvcdocdb.neo4j_enterprise.node_key_constraint_statement(main_label, properties, name=None)[source]
(constraint name, CREATE CONSTRAINT statement)for a NODE KEY.
- cvcdocdb.neo4j_enterprise.existence_constraint_statement(label, prop, entity='node', name=None)[source]
(constraint name, CREATE CONSTRAINT statement)forIS NOT NULL.
- cvcdocdb.neo4j_enterprise.type_constraint_statement(label, prop, cypher_type, entity='node', name=None)[source]
(constraint name, CREATE CONSTRAINT statement)forIS :: <TYPE>.
- cvcdocdb.neo4j_enterprise.normalize_edition(edition)[source]
Validate
Neo4jGraph(edition=...); returns it lower-cased.
- class cvcdocdb.neo4j_enterprise.Neo4jEnterpriseMixin[source]
Bases:
objectEnterprise-only operations of
Neo4jGraph.Expects the host class to provide
_driver,_session,_txandedition. See the module docstring for the license/testing caveats.- server_edition()[source]
Edition reported by the server (
"community"or"enterprise"), fromdbms.components(). Works in both modes.- Return type:
- drop_constraint(name)[source]
Drop a constraint by name if it exists (works in both editions).
- Parameters:
name (str)
- Return type:
None
- create_node_key_constraint(main_label, properties, name=None)[source]
Enterprise only. Require every
main_labelnode to havepropertiesset, and their combination to be unique. Idempotent.Fails (server-side) if existing nodes violate it — including nodes of the label inserted with a different pk shape.
- create_property_existence_constraint(label, prop, entity='node', name=None)[source]
Enterprise only. Require
propon every node withlabel(entity="node") or every relationship of typelabel(entity="relationship"). Idempotent.
- create_property_type_constraint(label, prop, cypher_type, entity='node', name=None)[source]
Enterprise only, Neo4j 5.9+. Require
prop(when present) to have Cypher typecypher_type— e.g."STRING","INTEGER","LIST<STRING NOT NULL>". Idempotent.
- create_database(name, wait=True)[source]
Enterprise only. Create a user database if it doesn’t exist. Runs on the
systemdatabase; needs theCREATE DATABASEprivilege. Withwait=Truereturns once the database is online.- Raises:
EnterpriseFeatureError – In Community mode or on a Community server.
- Parameters:
- Return type:
None
- drop_database(name, wait=True)[source]
Enterprise only. Drop a user database (and all its data) if it exists. Irreversible. Runs on the
systemdatabase.- Raises:
EnterpriseFeatureError – In Community mode or on a Community server.
- Parameters:
- Return type:
None