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.5.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.5-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqliac_snowflake-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 6841495a2d422248850f7202c682a99a05f7db22cababd69f820bd416d3c18cd
MD5 4e9129460e95d2ce36e915aceb3a1d7f
BLAKE2b-256 8dd84d4fe530b0dd83117fe6916b4b4ff321db6f5df363d14a965759547d4526

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqliac_snowflake-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 aa4113d9733fdb7faa3573c90c0528e028910d0ac14cfb5eca3a7e9ccb8bb85e
MD5 82418f28dfce6f3f727f3e5ef1dd5cf8
BLAKE2b-256 a91dd11fbe4a696d3661fc098f2980e254a46432009c483f6edc247f1a1658a8

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