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,
source=SourceMetadata(
objectType=ObjectType.table,
database="RETAIL_DB",
schema="dbo",
name="Customer",
),
target=TargetMetadata(
objectType=ObjectType.table,
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("source.objectType = 'table'")
# Update specific fields
registry.update(id, {"planning.wave": 2})
# Delete a code unit
registry.delete(id)
Testing
Integration tests live in tests/ and cover the full Python -> Rust -> disk -> Rust -> Python round-trip:
| Test file | What it verifies |
|---|---|
test_serialization.py |
FFI round-trip fidelity for all fields, Pydantic alias handling, extensions empty-map preservation |
test_errors.py |
ScaiError.error_code contract across FFI (1001, 1003) |
test_batch.py |
BatchResult wire format with partial failures (1004) |
test_crud.py |
Full CRUD lifecycle, upsert deep-merge semantics |
test_query.py |
find_by_object partial matching with exclude_unset |
Run them from the repo root:
./scripts/run-tests.sh python
Or directly:
cd crates/scai-state-python
maturin develop
pytest tests/ -v
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
Metadata
Release files for snowflake-code-unit-registry 0.9.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| snowflake_code_unit_registry-0.9.2.tar.gz | 349.3 kB | Without provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| snowflake_code_unit_registry-0.9.2-cp39-abi3-win_arm64.whl | CPython 3.9 | abi3 | Windows ARM64 | Details |
| snowflake_code_unit_registry-0.9.2-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| snowflake_code_unit_registry-0.9.2-cp39-abi3-manylinux_2_28_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| snowflake_code_unit_registry-0.9.2-cp39-abi3-manylinux_2_28_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| snowflake_code_unit_registry-0.9.2-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
| snowflake_code_unit_registry-0.9.2-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 53.1 MB
Release files / snowflake_code_unit_registry-0.9.2.tar.gz
| Download URL | snowflake_code_unit_registry-0.9.2.tar.gz |
|---|---|
| Size | 349.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f366e485e1c2cb3326f9b738d1bf876008904fe406de26ab555dff0d7f3328e4
|
|
BLAKE2b-256 checksum How to use checksums |
b39ca44af673e9b14e4429a71ebdb24538c285471eec2453a30cd01e9bbf6ee1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / snowflake_code_unit_registry-0.9.2-cp39-abi3-win_arm64.whl
| Download URL | snowflake_code_unit_registry-0.9.2-cp39-abi3-win_arm64.whl |
|---|---|
| Size | 8.4 MB |
| Tags | CPython 3.9 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5e83b40b303da64a669c768b99769f4a0ed5214536a035b8efa6fa879428a00f
|
|
BLAKE2b-256 checksum How to use checksums |
37b7db0c4eddbb128bb1d280a699dc96e2caa467c10af33dfd9524ca497a7e9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / snowflake_code_unit_registry-0.9.2-cp39-abi3-win_amd64.whl
| Download URL | snowflake_code_unit_registry-0.9.2-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 9.0 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
995ec06ea87f63fdf7a94e4d52d19ddd80f110cccddc56ba36f0d6bff437e1e2
|
|
BLAKE2b-256 checksum How to use checksums |
9950c4037dbde05f05707cdcea59f66bd79e325cf390bb822bcd08415d02e228
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / snowflake_code_unit_registry-0.9.2-cp39-abi3-manylinux_2_28_x86_64.whl
| Download URL | snowflake_code_unit_registry-0.9.2-cp39-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 9.3 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4d185b98b97c807caa55817b6a6f5c9abeef92bdb4c26ff59f56cfcdfb3fcca0
|
|
BLAKE2b-256 checksum How to use checksums |
0db86aa56e693713aa11b5633c9c736f7ae251f05b9ff12d447b19ab5e3c5b04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / snowflake_code_unit_registry-0.9.2-cp39-abi3-manylinux_2_28_aarch64.whl
| Download URL | snowflake_code_unit_registry-0.9.2-cp39-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 8.7 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
ca949e1bb610d5378c77a0f27469137f7f6de2ea212f406a1cbe14fe6c648818
|
|
BLAKE2b-256 checksum How to use checksums |
c2bfac148dbbad9017dab8649b8fd63508a4cb0e72e9310315fa1bf7d5dac2b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / snowflake_code_unit_registry-0.9.2-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | snowflake_code_unit_registry-0.9.2-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 8.4 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
39b21b4df5c2810cd5535b57d13306f628b0d82aca2935ad9037656a5fa4e0c8
|
|
BLAKE2b-256 checksum How to use checksums |
aa47aee7ef289443d330c9730d58932b920335e42f6bc7898505280c6a972ee1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / snowflake_code_unit_registry-0.9.2-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | snowflake_code_unit_registry-0.9.2-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 9.0 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
e8fc9bad2ece948fe9eb07f94fb30e0c50a34f31b9fdd50d215fac237c9b6c4e
|
|
BLAKE2b-256 checksum How to use checksums |
cdda3847d14d8b86236132e7211d36f0a905bb5ef23c711ee6895de8d6e7737c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for snowflake-code-unit-registry 0.9.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.