Upgrade from older versions

This page contains the list of new features and breaking changes of the driver from version 5.28 to 6.x. For a full list of changes, see the driver changelog.

The latest driver version of the 6.x series is compatible with Neo4j server both 4.4, 5.x, and 202[56].x, so you can upgrade the driver before you upgrade the server. At the same time, the driver version 5.28 is forward compatible with Neo4j server 202[56].x, so you could also upgrade the server before the driver; however, given that it’s easier to roll back an application upgrade than a server upgrade, it’s recommended to start with the driver.

When upgrading the Neo4j server to a newer version, the Cypher queries in your application might also need updating. The Drivers Migration Assistent doesn’t cover Cypher changes.
See Cypher → Deprecations, additions, and compatibility.

New features

New type Vector

The type Vector allows for storing and retrieving Cypher VECTOR objects to/from the database. The VECTOR type is suitable for efficiently storing lists of homogeneous numbers, such as embeddings.

GQL status objects in errors

Exception objects also expose errors as GQL-status objects. The main difference between Neo4j error codes and GQL error codes is that the latter are more granular. For more information, see Error handling.

Breaking changes and deprecations

Deprecated features are likely to be removed in the next major release.

Version Message Status

6.0

Environment

  • Dropped support for Python 3.7, 3.8, 3.9.

  • Package-alias neo4j-driver stopped receiving updates starting with 6.0. Install neo4j instead.

  • setup.py has been removed. Use a recent enough packaging/build tool supporting pyproject.toml.

Removed

6.0

Session — Methods .read_transaction() and .write_transaction() have been removed in favor of .execute_read() and .execute_write(). Through the new methods, the first argument of transaction functions is a ManagedTransaction object. It behaves like a regular Transaction object, except it does not offer the .commit(), .rollback(), .close(), and .closed() methods.

Removed

6.0

Driver and session objects are not implicitly closed through __del__() (destructor) anymore. This behaviour was non-deterministic as there is no guarantee that the destructor would ever be called. A ResourceWarning is emitted instead.
Call driver.close() explicitly or create the driver via a with statement.

Removed

6.0

Driver — The config option trust is not available anymore. The options trusted_certificates and ssl_context are available.

Removed

6.0

Bookmarks

  • The method Session.last_bookmark() has been removed in favor of Session.last_bookmarks(). The logic is similar, but the new method returns Bookmarks instead of str.

  • Bookmark has been removed in favor of Bookmarks.

  • Driver.session() no longer accepts raw string bookmarks as bookmarks argument. Use a Bookmarks object instead.

Removed

6.0

Imports

  • Import of the following modules has been removed without replacement, as they are internal and should not be used by client code: neo4j.packstream, neo4j.routing, neo4j.config, neo4j.meta, neo4j.data. neo4j.meta.version is exposed through neo4j.__version__.

  • Importing submodules from neo4j.time is not possible anymore. Import everything from neo4j.time directly instead.

  • Importing neo4j.work and its submodules is not possible anymore. Import everything from neo4j directly instead.

  • The following objects have been removed without replacement, as they are internal and should not be used by client code: neo4j.spatial.hydrate_point, neo4j.spatial.dehydrate_point, neoj4.Config, neoj4.PoolConfig, neoj4.SessionConfig, neoj4.WorkspaceConfig, neo4j.data.DataDehydrator, neo4j.data.DataHydrator.

  • The following modules have been removed: neo4j.conf, neo4j.data, neo4j.meta, neo4j.packstream, neo4j.routing, neo4j.time.arithmetic, neo4j.time.clock_implementation, neo4j.time.hydration, neo4j.time.metaclasses, neo4j.work, neo4j.work.query, neo4j.work.summary

  • api.Version has been removed as it’s unused now. ServerInfo.protocol_version is now a tuple[int, int] instead of a api.Version. This should be drop-in replacement is most cases.

  • Make undocumented constants, helper functions, and other internal items private. For a full list, see the changelog.

Removed

6.0

Class SummaryNotificationPosition has been removed in favor of SummaryInputPosition.

Removed

6.0

Neo4jError — Method .is_retriable() has been removed in favor of .is_retryable().

Removed

6.0

The magic method Record.__getslice__() has been removed. If you were calling it directly, use Record.__getitem__(slice(…​)) or simply record[…​] instead.

Removed

6.0

Changed errors raised under certain circumstances. For a full list, see the changelog.

Changed

6.0

Graph type sets (neo4j.graph.EntitySetView) can no longer be indexed by legacy id (int, e.g., graph.nodes[0]). Use the element_id instead (str, e.g., graph.nodes["…​"]).

Changed

5.0

Node, Relationship — Property id (int) is deprecated in favor of element_id (str). This also affects Graph objects, as indexing graph.nodes[…​] and graph.relationships[…​] with integers is deprecated in favor of indexing them with strings.

Deprecated

6.0

Notifications as Neo4j status codes are deprecated in favor of GQL status objects.

As a result,

Deprecated

6.0

Module neo4j.time.ClockTime and its accessors are deprecated.

Deprecated

6.0

Passing raw string bookmarks as initial_bookmarks to GraphDatabase.bookmark_manager() is deprecated. Use a Bookmarks object instead.

Deprecated