Skip to main content

cloe-delta-table-manager

Copier python uv Ruff Checked with mypy Code style: black pre-commit

Owner: initions

Usage

Run dtm from the directory containing project.yaml to execute the migration pipeline. Use plan to generate a deployment plan without executing SQL, or deploy to run the full pipeline including SQL execution.

You can also initialize a dtm project by using the init command, which will create a sample project structure with example SQL files and a project.yaml configuration.

uv run dtm --target dev plan
uv run dtm --target dev deploy

Migration file metadata

User migration SQL files can declare metadata in a leading comment. The first comment of the file is parsed as YAML and is currently used to express execution-order dependencies between migrations.

Supported keys:

  • depends_on — one or more migration files that must run before this one. Accepts a single path or a list. Paths are relative to the migration's own directory.
/* depends_on:
  - 001_create_table.sql
  - 002_alter_table.sql
*/
CREATE INDEX idx_email ON users(email);

A single dependency can also be given as a scalar:

/* depends_on: 001_create_table.sql */
ALTER TABLE users ADD COLUMN email VARCHAR(255);

Files without a leading comment are treated as having no metadata and no dependencies.

Known limitations

  • Migration metadata must be the first comment. The metadata block (see Migration file metadata) is read from the first comment in the file, which must be valid YAML. Any other content as the first comment causes a parsing error and the migration fails. Generic, non-metadata leading comments are not yet supported.

Connection environment variables

The Databricks connector reads credentials from environment variables. Set the workspace URL plus one authentication method.

export CLOE_DBX_WORKSPACE_URL="https://adb-xxxx.azuredatabricks.net"
export CLOE_DBX_SQL_WAREHOUSE_ID=""   # SQL warehouse / serverless compute used for execution

Authentication — choose one:

# Personal Access Token
export CLOE_DBX_PAT=""
# PAT can be derived from Databricks CLI
$(databricks auth token --host "$CLOE_DBX_WORKSPACE_URL" 2>/dev/null \
  | python3 -c "import json,sys; print(json.load(sys.stdin)['access_token'])" 2>/dev/null)

# Databricks-managed service principal
export CLOE_DBX_CLIENT_ID=""
export CLOE_DBX_CLIENT_SECRET=""

# Azure Entra ID service principal
export CLOE_AZURE_TENANT_ID=""
export CLOE_AZURE_CLIENT_ID=""
export CLOE_AZURE_CLIENT_SECRET=""

Optional defaults for SQL execution:

export CLOE_DBX_DEFAULT_CATALOG=""
export CLOE_DBX_DEFAULT_SCHEMA=""
export CLOE_DBX_STATEMENT_TIMEOUT="50s"   # Databricks synchronous max is 50s

Devcontainer

If the claude code devcontainer-feature is used, it expect you to have a local .credentials.json:

${localEnv:HOME}/.claude/.credentials.json

If you are setting this up for the first time, you need to create this file manually but it can be empty.

mkdir -p ~/.claude/
touch ~/.claude/.credentials.json

Testing

Snapshot Testing

This project uses inline-snapshot for test assertions. Snapshots capture the complete structure of test outputs, making tests more comprehensive and easier to maintain.

Running Tests

# Run all tests
uv run pytest

# Run specific test file
uv run pytest tests/state/test_state.py

Updating Snapshots

When you modify code that changes test outputs, you'll need to update the snapshots:

# Review and approve snapshot changes interactively
uv run pytest --inline-snapshot=review

# Automatically fix all snapshots (use with caution)
uv run pytest --inline-snapshot=fix

# Create new snapshots for tests with empty snapshot() calls
uv run pytest --inline-snapshot=create

Writing Tests with Snapshots

Use .model_dump() to convert Pydantic models to dictionaries before snapshotting:

from inline_snapshot import snapshot
from dirty_equals import IsStr, IsDatetime, IsUUID

def test_example(self):
    result = create_database_state()

    assert result.model_dump() == snapshot({
        "objects": {
            "db1": {
                "id": IsUUID(4),  # Dynamic UUID field
                "name": "db1",
                "created_at": IsDatetime(),  # Dynamic datetime field
            }
        },
        "metadata": {
            "version": 1,
            "delta_table_manager_version": IsStr(),
        }
    })

Use dirty-equals matchers (IsStr(), IsDatetime(), IsUUID(), etc.) for fields that change between test runs.

Metadata

Release files for cloe-delta-table-manager 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloe-delta-table-manager 0.2.1
File Size Uploaded Provenance Actions
cloe_delta_table_manager-0.2.1.tar.gz 68.0 kB Without provenance Details for cloe_delta_table_manager-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cloe-delta-table-manager 0.2.1
File Interpreter ABI Platform Actions
cloe_delta_table_manager-0.2.1-py3-none-any.whl Python 3 none any Details for cloe_delta_table_manager-0.2.1-py3-none-any.whl

Total release size: 156.5 kB

Release files / cloe_delta_table_manager-0.2.1.tar.gz

Download URL cloe_delta_table_manager-0.2.1.tar.gz
Size 68.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8c6a2b9e08963d9e61aba933a4b26d6a5bf7c233b4e80bcdbe6de5d825ee3d10
BLAKE2b-256 checksum
How to use checksums
a2b21d16a89f1658f79218007fe45edf667bc9fe80e17ffad2979f4aabae6e9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / cloe_delta_table_manager-0.2.1-py3-none-any.whl

Download URL cloe_delta_table_manager-0.2.1-py3-none-any.whl
Size 88.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
379990bab111a95482fbf45c7b1fdbf5e9259af641b6b4fdc84617c920a1010d
BLAKE2b-256 checksum
How to use checksums
1619f7ef4a280afc1c8df825cf9f906ba7d0794acf6615cfeda8709c0b806e58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for cloe-delta-table-manager 0.2.1

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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page