Setup and deployment¶
Prerequisites¶
- Python 3.11.
- A Snowflake account, warehouse, database, schema, and role with permission to create views and tables in the target schema.
- Git and a GitHub repository for CI.
Local setup¶
From the repository root, create and activate a virtual environment, then install the hash-locked dependencies:
python -m venv .venv
source .venv/bin/activate
python -m pip install --require-hashes -r editions/Snowflake/requirements-lock.txt
Keep the profile inside the edition so it cannot overwrite another project's ~/.dbt/profiles.yml. The -n option preserves an existing local profile:
cd editions/Snowflake/kit
mkdir -p .dbt
cp -n profiles.example.yml .dbt/profiles.yml
export DBT_PROFILES_DIR="$PWD/.dbt"
Set the required environment variables in the same shell: SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, SNOWFLAKE_PASSWORD, SNOWFLAKE_DATABASE, and SNOWFLAKE_WAREHOUSE. Optionally set SNOWFLAKE_ROLE (default TRANSFORMER) and SNOWFLAKE_SCHEMA (default DBT_DEV).
Do not commit the profile or credentials; profiles.yml is ignored by Git. Use a dedicated least-privilege role, a non-production schema, and a small auto-suspending warehouse for development (see operations).
Run from editions/Snowflake/kit/:
dbt build runs models and their tests in dependency order. For subsequent runs, dbt seed --full-refresh reloads the small example CSV files.
GitHub Actions¶
Pull requests run dbt parse with the placeholder profile in kit/.ci/ and no credentials. Parsing checks project configuration only; it does not connect to Snowflake or load the seeds.
Pushes to main also run dbt build against Snowflake using repository secrets. Add these secrets before merging to main: SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, SNOWFLAKE_PASSWORD, SNOWFLAKE_ROLE, SNOWFLAKE_DATABASE, SNOWFLAKE_WAREHOUSE, and SNOWFLAKE_SCHEMA. The workflow refuses to build unless the database name matches DBT_KIT_DEV…_DB or DBT_KIT_CI…_DB and the schema is the same prefix with a _SCHEMA suffix (for example, DBT_KIT_CI_DB and DBT_KIT_CI_SCHEMA). Use a dedicated CI role and avoid production credentials.
For production, replace seeded inputs with isolated test sources and follow your organization's approval and deployment controls.