Skip to main content

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 file
  • migrations/ — directory with env.py and versions/

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")

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
uv run pytest tests/ -v
uv run ruff check .
uv run ruff format --check .
uv run mypy pyignite_migrate/

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

pyignite_migrate-0.1.2.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyignite_migrate-0.1.2-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file pyignite_migrate-0.1.2.tar.gz.

File metadata

  • Download URL: pyignite_migrate-0.1.2.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyignite_migrate-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bfee1c6b08cbc1905b5bfbf6c44f518da7fbf1941e42043be095abb2d5bb1e55
MD5 ab8ea475c445f0c292ede6ad4f24d551
BLAKE2b-256 5216fd7b8b372772497822b55d7778baad74f284e201da11042a2e586268d996

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyignite_migrate-0.1.2.tar.gz:

Publisher: publish-pypi.yml on ivan-yurin/pyignite-migrate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyignite_migrate-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pyignite_migrate-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a57c6444eb2de1e5cf72e7990c2f19551bdc1d29a139764f28555d9b90bd092b
MD5 ea53f6f5ee55603598e0f704a3145207
BLAKE2b-256 de38ccde57c0291af4e16e7a0b266dc952cb49b72ed4df3f562348f708e31a6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyignite_migrate-0.1.2-py3-none-any.whl:

Publisher: publish-pypi.yml on ivan-yurin/pyignite-migrate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page