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.25
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 | Actions |
|---|---|---|---|---|
| snowflake_code_unit_registry-0.9.25.tar.gz | 344.2 kB | Without provenance | Details for snowflake_code_unit_registry-0.9.25.tar.gz |
Built distributions (wheels)
Total release size: 39.8 MB
Release files / snowflake_code_unit_registry-0.9.25.tar.gz
| Download URL | snowflake_code_unit_registry-0.9.25.tar.gz |
|---|---|
| Size | 344.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eed29ffb867fcf541b97f8a2543d95d5cac3d500b9e1d66c17c5b407631c98a6
|
|
BLAKE2b-256 checksum How to use checksums |
b8cf44a992318e5731760444d47adebab05d3aebadfc878d0e141989fd589248
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / snowflake_code_unit_registry-0.9.25-cp39-abi3-win_arm64.whl
| Download URL | snowflake_code_unit_registry-0.9.25-cp39-abi3-win_arm64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.9 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0faff1fae25ee21f3df39c6e2f9b6ddf4e17b0615aa80f41f9a9479e846f6637
|
|
BLAKE2b-256 checksum How to use checksums |
3c0c71304c8f5913e9d8091be046dfb91048db87c81782ab3774c702bec71a71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / snowflake_code_unit_registry-0.9.25-cp39-abi3-win_amd64.whl
| Download URL | snowflake_code_unit_registry-0.9.25-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 6.9 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6eb0350a7174c914d8d5fe272b96473dc09b57594a3a3b9337b77ad778816145
|
|
BLAKE2b-256 checksum How to use checksums |
1c7dc498d79f6bdfe7b34557cb8d693084147e50d5574b9c6bc2293cb0790fec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / snowflake_code_unit_registry-0.9.25-cp39-abi3-manylinux_2_28_x86_64.whl
| Download URL | snowflake_code_unit_registry-0.9.25-cp39-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 7.0 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
47d2b7648e88004340f794be9b763acec56be1fb4408c81d3b35241f2b77b7a3
|
|
BLAKE2b-256 checksum How to use checksums |
652f504cbc6ea55df884195252a1712fbc8ffc5a899a2fd11b0edad1dcdb0921
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / snowflake_code_unit_registry-0.9.25-cp39-abi3-manylinux_2_28_aarch64.whl
| Download URL | snowflake_code_unit_registry-0.9.25-cp39-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
4987b6a29fd1fdc2d7d89a8c3ec36220c400d409b54a3fcbf11a6245bfdc70c2
|
|
BLAKE2b-256 checksum How to use checksums |
997e0b0279c94bc6735d86902a3cd4d27235ab6d0183e03c69bfc936e97fa19d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / snowflake_code_unit_registry-0.9.25-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | snowflake_code_unit_registry-0.9.25-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f79e2c00d36afd621609fe3b866058f3c402b3e5e86d4c3232ed151cc7e60c80
|
|
BLAKE2b-256 checksum How to use checksums |
14853b4a7127015e0b31f6533347af9c922a4f89c365ab513d5b21d23d83075c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / snowflake_code_unit_registry-0.9.25-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | snowflake_code_unit_registry-0.9.25-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.7 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
94fb063eed886b560c3f20a7a7b1d878cbf24312634a1dd9e9e3116a2de906c9
|
|
BLAKE2b-256 checksum How to use checksums |
24e72e73455bfd96902cabab54cb958497336fdb80cae4dfa14c1e14ed362484
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for snowflake-code-unit-registry 0.9.25
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.