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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqliac_snowflake-0.1.8.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.8.tar.gz
Algorithm Hash digest
SHA256 5487201842b02890643e9624d7a1b8f1b743cbb0b459efabe0d297e5d833f06d
MD5 ee28eeccc93bdb15dd8347eea999acdc
BLAKE2b-256 194d94c59e6a6e0f4069834367b34df9cec1060d32996c8769ed482fb4997f80

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqliac_snowflake-0.1.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b13698bd8633d15ffd225531a734010ef2690fa708676ccd9df95495da0bdb18
MD5 e5ea3c99f326ae9f0680ae5c2b5b683b
BLAKE2b-256 4cc650a6495fe0f7a88b357617768e75955e75e73d3290e52fe2fbb175f6e162

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