Breaking Changes¶
This describes the breaking changes between Python Driver 1.7 and Python Driver 4.0
Version Scheme Changes¶
The version number has jumped from Python Driver 1.7 to Python Driver 4.0 to align with the Neo4j Database version scheme.
Python Versions¶
Python 2.7 is no longer supported.
Namespace Changes¶
import neo4j.v1
Has changed to
import neo4j
Secure Connection¶
Neo4j 4.0 is by default configured to use a unsecured connection.
The driver configuration argument encrypted is by default set to False.
Note: To be able to connect to Neo4j 3.5 set encrypted=True to have it configured as the default for that setup.
from neo4j import GraphDatabase
driver = GraphDatabase.driver(
    "bolt://localhost:7687",
    auth=("neo4j", "password"),
    encrypted=True,
)
driver.close()
Bookmark Changes¶
Introduced neo4j.Bookmark
Exceptions Changes¶
The exceptions in neo4j.exceptions has been updated and there are internal exceptions starting with the naming Bolt that should be propagated into the exceptions API.
See Errors for more about errors.
URI Scheme Changes¶
bolt+routing has been renamed to neo4j.
Class Renaming Changes¶
- BoltStatementResultis now- Result
- StatementResultSummaryis now- ResultSummary
- Statementis now- Query
Argument Renaming Changes¶
- statementis now- query
- cypheris now- query
- Session.run(cypher, ...is now- Session.run(query, ...
- Transaction.run(statement, ...is now- Transaction.run(query, ...
- StatementResultSummary.statementis now- ResultSummary.query
- StatementResultSummary.statement_typeis now- ResultSummary.query_type
- StatementResultSummary.protocol_versionis now- ResultSummary.server.protocol_version
API Changes¶
- Result.summary()has been replaced with- Result.consume(), this behaviour is to consume all remaining records in the buffer and returns the ResultSummary.
- Result.data(*items)has been changed to- Result.data(*keys)for alignment with- Record.data(*keys).
- Result.value(item=0, default=None)has been changed to- Result.value(key=0, default=None)for alignment with- Record.value(key=0, default=None).
- Result.values(*items)has been changed to- Result.values(*keys)for alignment with- Record.values(*keys).
- Transaction.sync()has been removed. Use- Result.consume()if the behaviour is to exhaust the result object.
- Transaction.successhas been removed.
- Transaction.close()behaviour changed. Will now only perform rollback if no commit have been performed.
- Session.sync()has been removed. Use- Result.consume()if the behaviour is to exhaust the result object.
- Session.detach()has been removed. Use- Result.consume()if the behaviour is to exhaust the result object.
- Session.next_bookmarks()has been removed.
- Session.has_transaction()has been removed.
- Session.closed()has been removed.
- Session.write_transactionand- Session.read_transactionwill start the retry timer after the first failed attempt.
Dependency Changes¶
- The dependency - neobolthas been removed.
- The dependency - neotimehas been removed.
- The - pytzis now a dependency.
Configuration Name Changes¶
- max_retry_timeis now- max_transaction_retry_time