Skip to main content

Snowflake adapter for SQLIaC — a Terraform alternative for SQL databases without a state file.

Project description

sqliac-snowflake

Snowflake adapter for SQLIaC — a Terraform alternative for SQL databases that uses no state file.

This package provides the Snowflake database connector and credential handling so SQLIaC can query Snowflake's live state and execute DDL to reconcile your declared resource definitions.

Installation

pip install sqliac-snowflake

This also installs sqliac (the CLI and core engine) and snowflake-connector-python.

Quick Start

Credentials

SQLIaC looks for Snowflake credentials in two places, in order of precedence:

1. Environment variables (recommended)

export SNOWFLAKE_ACCOUNT="my_account"
export SNOWFLAKE_USER="my_user"
export SNOWFLAKE_PASSWORD="my_password"
export SNOWFLAKE_WAREHOUSE="my_warehouse"
# Optional:
export SNOWFLAKE_DATABASE="my_db"
export SNOWFLAKE_SCHEMA="my_schema"
export SNOWFLAKE_ROLE="my_role"

2. Configuration file .sqliac/provider/credentials.toml

[snowflake]
account = "my_account"
user = "my_user"
password = "my_password"
warehouse = "my_warehouse"

Environment variables take precedence. Run sqliac init to scaffold this file.

Private key authentication

Set SNOWFLAKE_PRIVATE_KEY_PATH (relative path inside .sqliac/provider/) or SNOWFLAKE_PRIVATE_KEY (PEM string), optionally with SNOWFLAKE_PRIVATE_KEY_PASSPHRASE:

export SNOWFLAKE_ACCOUNT="my_account"
export SNOWFLAKE_USER="my_user"
export SNOWFLAKE_PRIVATE_KEY_PATH="rsa_key.p8"

Using SQLIaC with Snowflake

# Scaffold a project with Snowflake examples
sqliac init

# Configure your credentials and edit definitions/
# then preview and apply:

sqliac apply --dry-run
sqliac apply

The init command creates Snowflake-ready example templates for database, schema, and table resources under .sqliac/provider/.

Provider config

The adapter is registered via the sqliac.adapters entry point group. Your .sqliac/provider/config.toml should start with a top-level [snowflake] section:

[snowflake.database.ddl_command]
create = "CREATE OR ALTER"
alter  = "CREATE OR ALTER"
drop   = "DROP"

[snowflake.database.ddl_context]
object_name = "MODELING"
transient = false
data_retention_time_in_days = 1
wait_time = 0
[snowflake.database.ddl_context.depends_on]

API

The adapter exposes three classes, all available from the top-level package:

from sqliac_snowflake import SnowflakeAdapter, SnowflakeCredentials, SnowflakeConnectionManager
Class Role
SnowflakeAdapter Concrete BaseAdapter — executes queries and manages connections
SnowflakeCredentials Frozen dataclass — validates and stores account, user, password, warehouse, etc.
SnowflakeConnectionManager Thread-safe per-thread connection pool with keypair and password auth

All three are registered via the entry point sqliac.adapters / snowflake and resolved automatically by the SQLIaC CLI. You don't need to import them directly unless building custom tooling.

Supported credential fields

Field Required Env var
account Yes SNOWFLAKE_ACCOUNT
user Yes SNOWFLAKE_USER
password (one of) SNOWFLAKE_PASSWORD
private_key_path (one of) SNOWFLAKE_PRIVATE_KEY_PATH
private_key (one of) SNOWFLAKE_PRIVATE_KEY
private_key_passphrase No SNOWFLAKE_PRIVATE_KEY_PASSPHRASE
warehouse No SNOWFLAKE_WAREHOUSE
database No SNOWFLAKE_DATABASE
schema No SNOWFLAKE_SCHEMA
role No SNOWFLAKE_ROLE

License

MIT — see the sqliac package for details.

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

sqliac_snowflake-0.1.7.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

sqliac_snowflake-0.1.7-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file sqliac_snowflake-0.1.7.tar.gz.

File metadata

  • Download URL: sqliac_snowflake-0.1.7.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sqliac_snowflake-0.1.7.tar.gz
Algorithm Hash digest
SHA256 503c4b2898f9b68e21fff77ae5b74bf1d3bdaba791a81a73168349e70e71e20c
MD5 566fc1e3e3a7cb147ca4281b826fafd3
BLAKE2b-256 187443d203e39e386d48229790013e67c62f8a4d1c0fddc9b70d684fdf14c1f9

See more details on using hashes here.

File details

Details for the file sqliac_snowflake-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: sqliac_snowflake-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sqliac_snowflake-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 1003661f4158db5cef97fef45089fee045533287fda21cea102f712402ec0ea3
MD5 1e966eafea5399b759fe977e9f0250de
BLAKE2b-256 75ef39c397578d97ae8dc6683524ef9b506ccae0b68aceb0d42806ea26d41e9a

See more details on using hashes here.

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