Skip to main content

Meltano State Backend for Snowflake

Project description

meltano-state-backend-snowflake

This is a Meltano extension that provides a Snowflake state backend.

Installation

This package needs to be installed in the same Python environment as Meltano.

From GitHub

With uv

uv tool install --with git+https://github.com/meltano/meltano-state-backend-snowflake.git meltano

With pipx

pipx install meltano
pipx inject meltano git+https://github.com/meltano/meltano-state-backend-snowflake.git

Configuration

To store state in Snowflake, set the state_backend.uri setting to a Snowflake SQLAlchemy-style URI:

snowflake://<user>:<password>@<account>/<database>/<schema>?warehouse=<warehouse>&role=<role>

State will be stored in two tables that Meltano will create automatically:

  • meltano_state - Stores the actual state data
  • meltano_state_locks - Manages concurrency locks

All connection parameters can be provided in the URI (including as query parameters), as individual Meltano settings, or a mix of both. Explicit settings take precedence over URI values.

Using a single URI with query parameters:

state_backend:
  uri: snowflake://my_user:my_password@my_account/my_database/my_schema?warehouse=my_warehouse&role=my_role

Using a URI with separate settings for warehouse and role:

state_backend:
  uri: snowflake://my_user:my_password@my_account/my_database/my_schema
  snowflake:
    warehouse: my_warehouse  # Required: The compute warehouse to use
    role: my_role           # Optional: The role to use for the connection

Using individual settings for everything:

state_backend:
  uri: snowflake://my_account
  snowflake:
    account: my_account
    user: my_user
    password: my_password
    warehouse: my_warehouse
    database: my_database
    schema: my_schema      # Defaults to PUBLIC if not specified
    role: my_role          # Optional

Connection Parameters

  • account: Your Snowflake account identifier (e.g., myorg-account123)
  • user: The username for authentication
  • password: The password for authentication (required unless using key pair authentication)
  • warehouse: The compute warehouse to use (required)
  • database: The database where state will be stored
  • schema: The schema where state tables will be created (defaults to PUBLIC)
  • role: Optional role to use for the connection
  • private_key_base64: Optional base64-encoded DER private key for key pair authentication

Key Pair Authentication

Instead of password-based authentication, you can use Snowflake key pair authentication. Provide the private key as a base64-encoded DER-format string:

state_backend:
  uri: snowflake://my_user@my_account/my_database?warehouse=my_warehouse
  snowflake:
    private_key_base64: MIIEvgIBADANBg...  # base64-encoded DER private key

The private key can also be passed as a URI query parameter:

snowflake://my_user@my_account/my_database?warehouse=my_warehouse&private_key_base64=MIIEvgIBADANBg...

Or via an environment variable:

export MELTANO_STATE_BACKEND_SNOWFLAKE_PRIVATE_KEY_BASE64='MIIEvgIBADANBg...'

To generate the base64-encoded DER key from a PEM private key file:

openssl pkcs8 -topk8 -inform PEM -outform DER -in rsa_key.pem -nocrypt | base64

When using key pair authentication, no password is required.

Security Considerations

When storing credentials:

  • Use environment variables for sensitive values in production
  • Ensure the user has CREATE TABLE, INSERT, UPDATE, DELETE, and SELECT privileges

Example using environment variables:

export MELTANO_STATE_BACKEND_SNOWFLAKE_PASSWORD='my_secure_password'
meltano config set meltano state_backend.uri 'snowflake://my_user@my_account/my_database?warehouse=my_warehouse'

Passwords containing special characters (e.g. @, %) must be URL-encoded when included in the URI. For example, p@ss becomes p%40ss.

Development

Setup

uv sync

Run tests

Run all tests, type checks, linting, and coverage:

uvx --with tox-uv tox run-parallel

Bump the version

Using the GitHub CLI:

gh release create v<new-version>

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

meltano_state_backend_snowflake-0.2.4.tar.gz (144.9 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file meltano_state_backend_snowflake-0.2.4.tar.gz.

File metadata

File hashes

Hashes for meltano_state_backend_snowflake-0.2.4.tar.gz
Algorithm Hash digest
SHA256 0e13c7e722ff385dd024e883e46a0dac24142b3894990bfa351b3a2f492b8474
MD5 eef539c4831df01d5ba5fba7bfb62fbb
BLAKE2b-256 ce4cc86bb6dfcb93f1caeab0a7ef15930a13bbdcf651742224e4b2aa0baf2461

See more details on using hashes here.

Provenance

The following attestation bundles were made for meltano_state_backend_snowflake-0.2.4.tar.gz:

Publisher: release.yaml on meltano/meltano-state-backend-snowflake

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

File details

Details for the file meltano_state_backend_snowflake-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for meltano_state_backend_snowflake-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 072c7dfe2da734f9cc2251e27249b6f882491f40d9de4916a0659bd6891f3d82
MD5 e0522251cfb69e74405486c4e2836a21
BLAKE2b-256 e81c2bf19883a62e3d92c6f64d3bcbd511a70b7adc9a329498c4869aeb0836b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for meltano_state_backend_snowflake-0.2.4-py3-none-any.whl:

Publisher: release.yaml on meltano/meltano-state-backend-snowflake

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