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 datameltano_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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file meltano_state_backend_snowflake-0.2.3.tar.gz.
File metadata
- Download URL: meltano_state_backend_snowflake-0.2.3.tar.gz
- Upload date:
- Size: 137.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c78136684ea04c5aaf0d908d5681beed6edf5f8d91a1f0ae7339fef96c5acc6
|
|
| MD5 |
fa55e782fd9bdf875ab4512ab5297e3d
|
|
| BLAKE2b-256 |
c4b9034cc75cff35efbe576b29c14d06843bbd38de31b92aece100791829fb81
|
Provenance
The following attestation bundles were made for meltano_state_backend_snowflake-0.2.3.tar.gz:
Publisher:
release.yaml on meltano/meltano-state-backend-snowflake
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
meltano_state_backend_snowflake-0.2.3.tar.gz -
Subject digest:
9c78136684ea04c5aaf0d908d5681beed6edf5f8d91a1f0ae7339fef96c5acc6 - Sigstore transparency entry: 939470327
- Sigstore integration time:
-
Permalink:
meltano/meltano-state-backend-snowflake@93bbc2188fe9822cbb08f7c88122062837bbdb9f -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/meltano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@93bbc2188fe9822cbb08f7c88122062837bbdb9f -
Trigger Event:
push
-
Statement type:
File details
Details for the file meltano_state_backend_snowflake-0.2.3-py3-none-any.whl.
File metadata
- Download URL: meltano_state_backend_snowflake-0.2.3-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b17f8e7373402ccc3be340edb3dc10eeb49d4badce680dc8b3abb570775fcf8
|
|
| MD5 |
a35da4881a2062e0b596146388837998
|
|
| BLAKE2b-256 |
8c8d15565c9590568aeedce67975d2e5a558fc93c75e7168d4c9f1e29b00fe40
|
Provenance
The following attestation bundles were made for meltano_state_backend_snowflake-0.2.3-py3-none-any.whl:
Publisher:
release.yaml on meltano/meltano-state-backend-snowflake
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
meltano_state_backend_snowflake-0.2.3-py3-none-any.whl -
Subject digest:
5b17f8e7373402ccc3be340edb3dc10eeb49d4badce680dc8b3abb570775fcf8 - Sigstore transparency entry: 939470335
- Sigstore integration time:
-
Permalink:
meltano/meltano-state-backend-snowflake@93bbc2188fe9822cbb08f7c88122062837bbdb9f -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/meltano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@93bbc2188fe9822cbb08f7c88122062837bbdb9f -
Trigger Event:
push
-
Statement type: