Lightweight Liquibase-style XML changelog executor for Neo4j/MDB updates
Project description
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="NWM">
<neo4j:cypher>CREATE (n:test {handle:'TEST'})</neo4j:cypher>
</changeSet>
</databaseChangeLog>
Parameterized Cypher can use MDB JSON params:
<changeSet id="2" author="NWM">
<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/path/local_changelog.xml",
)
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 anid,author, and<neo4j:cypher>element. - Changesets run in XML order.
- All changesets run inside one transaction.
- If any changeset fails, the transaction is rolled back and
ChangelogExecutionErroris raised. dry_run=Trueparses the changelog and returns a summary without executing Cypher.- No
_changelogmetadata node is created by this package yet.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mdb_changelog_runner-0.1.2.tar.gz.
File metadata
- Download URL: mdb_changelog_runner-0.1.2.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bc5ca39d1ce797eca207e5315f9cb8419d012cbb06df8bc4037c65ac78e21d6
|
|
| MD5 |
1e7c287256b3f8497765d7e49f4544ed
|
|
| BLAKE2b-256 |
e092935073c5532c1bd55594b7152fefc701517b7bc01639b45e2451514bec5e
|
Provenance
The following attestation bundles were made for mdb_changelog_runner-0.1.2.tar.gz:
Publisher:
publish.yml on CBIIT/MDB-Changelog-Runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mdb_changelog_runner-0.1.2.tar.gz -
Subject digest:
9bc5ca39d1ce797eca207e5315f9cb8419d012cbb06df8bc4037c65ac78e21d6 - Sigstore transparency entry: 1955359763
- Sigstore integration time:
-
Permalink:
CBIIT/MDB-Changelog-Runner@f0ecb88603de864343185d00a5ed0ffe39cc8922 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/CBIIT
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ecb88603de864343185d00a5ed0ffe39cc8922 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mdb_changelog_runner-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mdb_changelog_runner-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aedc3d7cd40a8c3ff8e151493fb19eb47c122ec678079b0fc083a6887a104d19
|
|
| MD5 |
10fc37599e128fb12b4e267d366ef547
|
|
| BLAKE2b-256 |
377370878d73fae3c883f78cfc22d3c2ac730a24bccfe18eeadae2e09a0ea96c
|
Provenance
The following attestation bundles were made for mdb_changelog_runner-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on CBIIT/MDB-Changelog-Runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mdb_changelog_runner-0.1.2-py3-none-any.whl -
Subject digest:
aedc3d7cd40a8c3ff8e151493fb19eb47c122ec678079b0fc083a6887a104d19 - Sigstore transparency entry: 1955359855
- Sigstore integration time:
-
Permalink:
CBIIT/MDB-Changelog-Runner@f0ecb88603de864343185d00a5ed0ffe39cc8922 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/CBIIT
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ecb88603de864343185d00a5ed0ffe39cc8922 -
Trigger Event:
push
-
Statement type: