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¶
BoltStatementResult
is nowResult
StatementResultSummary
is nowResultSummary
Statement
is nowQuery
Argument Renaming Changes¶
statement
is nowquery
cypher
is nowquery
Session.run(cypher, ...
is nowSession.run(query, ...
Transaction.run(statement, ...
is nowTransaction.run(query, ...
StatementResultSummary.statement
is nowResultSummary.query
StatementResultSummary.statement_type
is nowResultSummary.query_type
StatementResultSummary.protocol_version
is nowResultSummary.server.protocol_version
API Changes¶
Result.summary()
has been replaced withResult.consume()
, this behaviour is to consume all remaining records in the buffer and returns the ResultSummary.Result.data(*items)
has been changed toResult.data(*keys)
for alignment withRecord.data(*keys)
.Result.value(item=0, default=None)
has been changed toResult.value(key=0, default=None)
for alignment withRecord.value(key=0, default=None)
.Result.values(*items)
has been changed toResult.values(*keys)
for alignment withRecord.values(*keys)
.Transaction.sync()
has been removed. UseResult.consume()
if the behaviour is to exhaust the result object.Transaction.success
has been removed.Transaction.close()
behaviour changed. Will now only perform rollback if no commit have been performed.Session.sync()
has been removed. UseResult.consume()
if the behaviour is to exhaust the result object.Session.detach()
has been removed. UseResult.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_transaction
andSession.read_transaction
will start the retry timer after the first failed attempt.
Dependency Changes¶
The dependency
neobolt
has been removed.The dependency
neotime
has been removed.The
pytz
is now a dependency.
Configuration Name Changes¶
max_retry_time
is nowmax_transaction_retry_time