Skip to main content

mdb-changelog-runner

Lightweight Python execution for Liquibase-style Neo4j/MDB changelog XML.

This package parses ordered <changeSet> entries and executes their <neo4j:cypher> queries in a single Neo4j transaction. It does not require Java, the JDK, Liquibase, or the Liquibase Neo4j extension at runtime.

Install

uv add mdb-changelog-runner

For local development:

uv sync
uv run pytest

XML format

Existing Liquibase Neo4j changelogs are supported:

<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:neo4j="http://www.liquibase.org/xml/ns/dbchangelog-ext"
  xmlns:mdb="https://cbiit.github.io/mdb/changelog">
  <changeSet id="1" author="MDB-runner">
    <neo4j:cypher>CREATE (n:test {handle:'TEST'})</neo4j:cypher>
  </changeSet>
</databaseChangeLog>

Parameterized Cypher can use MDB JSON params:

<changeSet id="2" author="MDB-runner">
  <neo4j:cypher>
    MERGE (n:term {handle: $handle, value: $value})
  </neo4j:cypher>
  <mdb:params>{"handle": "C123", "value": "Example"}</mdb:params>
</changeSet>

Usage

import logging

from neo4j import GraphDatabase
from mdb_changelog_runner import ChangelogExecutor

driver = GraphDatabase.driver(uri, auth=(user, password))
logger = logging.getLogger("mdb_changelog_runner")

executor = ChangelogExecutor(driver, logger=logger)
result = executor.execute(
    "local_changelog.xml",
    "s3://my-bucket/model_changelogs/CTDC/local_changelog.xml",
    # Optional changelog_scope
    changelog_scope="model",
    # Optional changelog_scope_path
    changelog_scope_path="model_changelogs/CTDC",
    # Optional schema_mode=True for schema-only changelogs
)

print(result.changesets_executed)

execute() opens a session when given a Neo4j driver. It can also accept an already-open session-like object that provides begin_transaction().

Behavior

  • Each <changeSet> must have an id, author, and <neo4j:cypher> element.
  • Changesets run in XML order.
  • All changesets run inside one transaction unless schema_mode=True is used.
  • In schema mode, each changeSet is committed separately.
  • After all changesets succeed, one _changelog metadata node is written. In single-transaction mode it is written in the same transaction; in schema mode it is written in a final transaction. It records the run timestamp, changelog S3 location, optional scope values, number of executed changesets, unique authors, and a deprecate_after timestamp.
  • The new _changelog node links to the previous matching run with :prev_changelog. Matching uses scope values when provided, otherwise location.
  • Empty changelogs do not write _changelog metadata.
  • If any changeset fails, the transaction is rolled back and ChangelogExecutionError is raised. No metadata is written for failed runs.
  • dry_run=True parses the changelog and returns a summary without executing Cypher.
  • By default, deprecate_after is 6 months after the run timestamp. Pass a datetime.timedelta as ChangelogExecutor(..., deprecate_after=...) to override it.

Release files for mdb-changelog-runner 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mdb-changelog-runner 1.0.4
File Size Uploaded
mdb_changelog_runner-1.0.4.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mdb-changelog-runner 1.0.4
File Interpreter ABI Platform
mdb_changelog_runner-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 14.2 kB

Release files / mdb_changelog_runner-1.0.4.tar.gz

Download URL mdb_changelog_runner-1.0.4.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
57bab5bbc25f5d4e6f22e458b6a6b0f17e46adc82932f9df584d80381cba75ca
BLAKE2b-256 checksum
How to use checksums
03edaf1b632c01c316d25146b11e29aea341383b3cd608386925571dec5f0efd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / mdb_changelog_runner-1.0.4-py3-none-any.whl

Download URL mdb_changelog_runner-1.0.4-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
437dcf84051bd79ba386d41c44679822727dbcefc55096b73dde6d6aee723bc1
BLAKE2b-256 checksum
How to use checksums
9351f7a1c220ddc4ef738f92b7eccb7c590bc1795735217b753a2b140ed40151
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page