Skip to main content

SCAI state management library for database migrations

Project description

scai-state

SCAI state management library for database migrations.

Installation

pip install scai-state

Usage

from scai_state import CodeUnitRegistry
from scai_state.types import CodeUnit, SourceMetadata, TargetMetadata, ObjectType, Kind

# Initialize a new registry
registry = CodeUnitRegistry.init("/path/to/repo")

# Or open an existing registry
registry = CodeUnitRegistry.open("/path/to/existing/repo")

# Create a code unit
code_unit = CodeUnit(
    kind=Kind.databaseObject,
    objectType=ObjectType.table,
    source=SourceMetadata(
        database="RETAIL_DB",
        schema="dbo",
        name="Customer",
    ),
    target=TargetMetadata(
        database="RETAIL",
        schema="DBO",
        name="CUSTOMER",
    ),
)

# Returns the ID (auto-generated if not provided)
id = registry.create(code_unit)

# Load a code unit
cu = registry.load(id)

# List all code units (with optional filter)
results = registry.list("objectType = 'table'")

# Update specific fields
registry.update(id, {"planning.wave": 2})

# Delete a code unit
registry.delete(id)

Building from Source

This package requires Rust and maturin to build:

# Install maturin
pip install maturin

# Build and install in development mode
cd crates/scai-state-python
maturin develop

License

Apache-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

snowflake_code_unit_registry-0.2.0.tar.gz (29.9 kB view details)

Uploaded Source

Built Distributions

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

snowflake_code_unit_registry-0.2.0-cp39-abi3-win_arm64.whl (1.7 MB view details)

Uploaded CPython 3.9+Windows ARM64

snowflake_code_unit_registry-0.2.0-cp39-abi3-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.9+Windows x86-64

snowflake_code_unit_registry-0.2.0-cp39-abi3-manylinux_2_34_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.34+ x86-64

snowflake_code_unit_registry-0.2.0-cp39-abi3-manylinux_2_34_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.34+ ARM64

snowflake_code_unit_registry-0.2.0-cp39-abi3-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

snowflake_code_unit_registry-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file snowflake_code_unit_registry-0.2.0.tar.gz.

File metadata

File hashes

Hashes for snowflake_code_unit_registry-0.2.0.tar.gz
Algorithm Hash digest
SHA256 477f253fbfd0497bf8003e5ac7081c24c20b1fb49e3aacb777870c7fbeaf548b
MD5 6155f5ee03a0c15d20e47f2fe8831b02
BLAKE2b-256 b19cb00a36e322f540eb1da3b242b123c8721fcc1ffa2da0a1a6709c72dcf4ea

See more details on using hashes here.

File details

Details for the file snowflake_code_unit_registry-0.2.0-cp39-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for snowflake_code_unit_registry-0.2.0-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 ded36f46b548d7a0c5e8bcdfe1a2a662e3ffe2800aeea23d5efe3b857d213162
MD5 3302c04e547c969686f91caa3f5ddb6b
BLAKE2b-256 2936f6bd75b1e8126f0c6c21741a68e580f5f7c719c64b16b755ac3a677c3e82

See more details on using hashes here.

File details

Details for the file snowflake_code_unit_registry-0.2.0-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for snowflake_code_unit_registry-0.2.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8af82fd83eafd7ea7d49518e66d529bf5cfd2235fb27890622904e6e9b16c030
MD5 0c7f36ccfb554019fd76b73ddb865146
BLAKE2b-256 6d0e73c96b6615f0a59f4814f0cfcb405f4ab2f0856729860555e067b0ea5835

See more details on using hashes here.

File details

Details for the file snowflake_code_unit_registry-0.2.0-cp39-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for snowflake_code_unit_registry-0.2.0-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 29afc0fcb2c730846eae456eaa368eae1f3da877487f9a84e61fec940d3278d7
MD5 40a4fdc87b1f7b6a0aff80ed7eacc530
BLAKE2b-256 79ee08c735c32ee272db31a840659e0f8a91595e3ac34c9fcae7926a1acd31df

See more details on using hashes here.

File details

Details for the file snowflake_code_unit_registry-0.2.0-cp39-abi3-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for snowflake_code_unit_registry-0.2.0-cp39-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 67938361096e1fae2318b7fcb429d474f6b76ba87e0c89d0b20db4e118de86ec
MD5 d813df350666197c193f6db09e009c8b
BLAKE2b-256 bd8dde7a4181e3ee5b1f646188ac27522ef04e85e96f6e361646c31084a19454

See more details on using hashes here.

File details

Details for the file snowflake_code_unit_registry-0.2.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for snowflake_code_unit_registry-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea12b0437f5e16f67e7a197065a2782ff6db485fc70ab8039ff3fcab437e8d2d
MD5 313ffc1de1261507052e2559a6f671bf
BLAKE2b-256 11302d36ba5dd576c8e5b79eaec52b7a3b893c99037adafa929d0bb0361bf954

See more details on using hashes here.

File details

Details for the file snowflake_code_unit_registry-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for snowflake_code_unit_registry-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8ec1f039fdf462d78df17c67dcfd634a86709940093fcb8952db2eb0f642924d
MD5 ebf3125cc777cceb9ab314206bebd2b3
BLAKE2b-256 dfd9e0d4cf94de9f30733ddeadb884374979785dd02a6dd6cda2e13f4efe4562

See more details on using hashes here.

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