Database migration tool for Apache Ignite
Project description
pyignite-migrate
Database migration tool for Apache Ignite.
Installation
pip install pyignite-migrate
or with uv:
uv add pyignite-migrate
Quick Start
1. Initialize migration environment
pyignite-migrate init
This creates:
pyignite_migrate.ini— configuration filemigrations/— directory withenv.pyandversions/
2. Configure connection
Edit pyignite_migrate.ini:
[pyignite_migrate]
hosts = 127.0.0.1:10800
script_location = migrations
schema = PUBLIC
3. Create a migration
pyignite-migrate revision -m "create users table"
Edit the generated file in migrations/versions/:
from pyignite_migrate.operations import op
revision = '0001'
down_revision = None
description = 'create users table'
def upgrade():
op.execute_sql("""
CREATE TABLE users (
id INT,
name VARCHAR(100),
email VARCHAR(255),
PRIMARY KEY (id)
)
""")
op.execute_sql("CREATE INDEX idx_users_email ON users (email)")
def downgrade():
op.execute_sql("DROP INDEX IF EXISTS idx_users_email")
op.execute_sql("DROP TABLE IF EXISTS users")
Revision IDs are generated as zero-padded sequential numbers:
0001, 0002, 0003, ...
4. Apply migrations
pyignite-migrate upgrade head
5. Rollback
pyignite-migrate downgrade -1 # one step back
pyignite-migrate downgrade base # revert all
CLI Commands
| Command | Description |
|---|---|
init |
Initialize migration environment |
revision -m "msg" |
Create a new migration |
upgrade [head|rev_id] |
Apply migrations |
downgrade <base|-N|rev_id> |
Revert migrations |
current |
Show current revision |
history |
Show migration history |
heads |
Show head revision(s) |
stamp <rev_id|base> |
Set version without running migrations |
Available Operations
from pyignite_migrate.operations import op
# SQL
op.execute_sql(query, query_args=None, schema=None)
# Cache management
op.create_cache(name, config=None)
op.destroy_cache(name)
Configuration
pyignite_migrate.ini:
[pyignite_migrate]
# Comma-separated host:port pairs
hosts = 127.0.0.1:10800
# Path to migration scripts (relative to this file)
script_location = migrations
# SQL schema
schema = PUBLIC
# Version tracking table name
version_table = __pyignite_migrate_version
Requirements
- Python >= 3.10
- CI checks run on Python 3.10, 3.11, 3.12, 3.13, and 3.14
- Apache Ignite with thin client protocol
Development
uv sync
docker compose up -d --wait ignite
uv run pytest tests/ -v
uv run ruff check .
uv run ruff format --check .
uv run mypy pyignite_migrate/
docker compose down
Integration tests use a real Ignite node.
By default they connect to 127.0.0.1:10800.
Override with PYIGNITE_TEST_HOST and PYIGNITE_TEST_PORT.
Release
See RELEASING.md for build and PyPI publishing steps.
License
Apache License 2.0
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 pyignite_migrate-0.1.3.tar.gz.
File metadata
- Download URL: pyignite_migrate-0.1.3.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f6308a0c97ece67fb475acd1b8a193cbb172d8e52345fc563b56e7cbd266e52
|
|
| MD5 |
e955622d4da2aaf1594741de09832209
|
|
| BLAKE2b-256 |
48f57c7337892fff9b850718488a5106db3f7914a9cfb55be8e9bc85f92f67cf
|
Provenance
The following attestation bundles were made for pyignite_migrate-0.1.3.tar.gz:
Publisher:
publish-pypi.yml on ivan-yurin/pyignite-migrate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyignite_migrate-0.1.3.tar.gz -
Subject digest:
8f6308a0c97ece67fb475acd1b8a193cbb172d8e52345fc563b56e7cbd266e52 - Sigstore transparency entry: 1079044428
- Sigstore integration time:
-
Permalink:
ivan-yurin/pyignite-migrate@fa0375433803ea3612ea955003bd7a147ddcaf40 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/ivan-yurin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@fa0375433803ea3612ea955003bd7a147ddcaf40 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyignite_migrate-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pyignite_migrate-0.1.3-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
198c0fc7a5074ce2a11b768cf07d9ece6f8020e52114d24c72c9bdedc020a957
|
|
| MD5 |
067100e028d23401db717a15fe818b68
|
|
| BLAKE2b-256 |
b78ad009ec54d051944051811fcb996512080a775ab90dc1831391ad37e07033
|
Provenance
The following attestation bundles were made for pyignite_migrate-0.1.3-py3-none-any.whl:
Publisher:
publish-pypi.yml on ivan-yurin/pyignite-migrate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyignite_migrate-0.1.3-py3-none-any.whl -
Subject digest:
198c0fc7a5074ce2a11b768cf07d9ece6f8020e52114d24c72c9bdedc020a957 - Sigstore transparency entry: 1079044430
- Sigstore integration time:
-
Permalink:
ivan-yurin/pyignite-migrate@fa0375433803ea3612ea955003bd7a147ddcaf40 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/ivan-yurin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@fa0375433803ea3612ea955003bd7a147ddcaf40 -
Trigger Event:
push
-
Statement type: