Skip to content

feat: support bolt+routing#391

Draft
mattkjames7 wants to merge 2 commits into
mainfrom
bolt-routing
Draft

feat: support bolt+routing#391
mattkjames7 wants to merge 2 commits into
mainfrom
bolt-routing

Conversation

@mattkjames7

@mattkjames7 mattkjames7 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description

Expose bolt+routing support for Memgraph HA provided by pymgclient in memgraph/pymgclient#86

Pull request type

Please delete options that are not relevant.

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring with functional or API changes
  • Refactoring without functional or API changes
  • Build or packaging related changes
  • Documentation content changes
  • Other (please describe):

Related issues

Delete section if this PR doesn't resolve any issues.

Closes (link to issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

######################################

Reviewer checklist (the reviewer checks this part)

  • Core feature implementation
  • Tests
  • Code documentation
  • Documentation on gqlalchemy/docs

######################################

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Expose client-side Bolt routing support (for Memgraph HA) through GQLAlchemy’s connection/vendor layers, and add CI + tests to validate routed read/write behavior.

Changes:

  • Add routing-capable connection creation (routing, access_mode, resolver) to MemgraphConnection and plumb it through the Memgraph vendor client.
  • Introduce a GQLAlchemyTransientError and map mgclient.TransientError via database_error_handler.
  • Add HA routing integration tests plus a Docker-based HA cluster bootstrap script and CI workflow step.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
gqlalchemy/connection.py Adds routing/access-mode/resolver plumbing into mgclient.connect(...) creation.
gqlalchemy/vendors/memgraph.py Passes routing parameters from Memgraph client into MemgraphConnection.
gqlalchemy/exceptions.py Adds GQLAlchemyTransientError and maps transient driver errors in the decorator.
gqlalchemy/__init__.py Exposes new exception types at the package top-level.
tests/test_exceptions.py Adds unit tests for transient vs non-transient error mapping behavior.
tests/integration/test_routing.py Adds integration tests validating routed READ/WRITE connections against an HA cluster.
scripts/ha_cluster.sh Adds a helper script to start/stop a local Memgraph HA cluster in Docker for tests/CI.
pytest.ini Registers a routing marker for HA-dependent tests.
pyproject.toml Temporarily points pymgclient to a git branch via uv sources to develop/test routing.
.github/workflows/build-and-test.yml Starts/stops the HA cluster in CI (when license secrets exist) to run routing tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gqlalchemy/exceptions.py
Comment on lines 222 to 226
return func(*args, **kwargs)
except mgclient.TransientError as e:
raise GQLAlchemyTransientError(e) from e
except Exception as e:
raise GQLAlchemyDatabaseError(e) from e
Comment thread pyproject.toml
Comment on lines +97 to +100
# TEMPORARY: client-side routing (connect(routing=True, ...)) is not yet in a
# released pymgclient. Track the branch so routing can be developed/tested;
# drop this and bump the "pymgclient" pin above once it ships in a release.
pymgclient = { git = "https://github.com/memgraph/pymgclient.git", branch = "bolt-routing-wrapper" }
Comment thread tests/test_exceptions.py
Comment on lines +31 to +34
def test_transient_error_is_mapped_to_gqlalchemy_transient_error():
@database_error_handler
def boom():
raise mgclient.TransientError("instance briefly unreachable during a failover")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs needed Docs needed feature feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants