- Simple demo using dbt with snowflake warehouse
user | DBT_CLOUD |
role | transformer |
schema | analytics |
database | dev |
warehouse | transformer |
Dropping user & role if they already exists.
use role accountadmin;
drop user if exists dbt_cloud;
drop user if exists dbt_cloud_dev;
drop role if exists transformer;
drop role if exists transformer_dev;
Creating a database.
create database DEV comment = 'Development database';
Create schemas.
create schema "DEV"."ANALYTICS" comment = 'Data layer for end user';
Create an access role.
create role transformer comment = 'Role for dbt';
Create a warehouse.
create warehouse transforming with
warehouse_size = 'XSMALL'
warehouse_type = 'STANDARD'
auto_suspend = 300
auto_resume = TRUE
comment = 'Warehouse to transform data';
Granting role permissions
grant usage,operate on warehouse transforming to role transformer;
grant usage,create schema on database DEV to role transformer;
grant all on schema "DEV"."ANALYTICS" to role transformer;
Sequence of commands:
pip install dbt
pip install dbt-snowflake
dbt --version
dbt debug
dbt init
dbt deps
dbt seed
dbt run
dbt docs generate
dbt docs serve --port 8001
- You can also install dbt using these instructions
Profile template:
# For more information on how to configure this file, please see:
# https://docs.getdbt.com/docs/profile
dbt_demo:
target: dev
outputs:
dev:
type: snowflake
account: your-snowflake-account-id-here
user: your-user-name-here
password: your-password-here
role: TRANSFORMER
database: DEV
warehouse: TRANSFORMING
schema: STG
threads: 4
client_session_keep_alive: False
- Learn more about dbt in the docs
- Check out Discourse for commonly asked questions and answers
- Join the chat on Slack for live discussions and support
- Find dbt events near you
- Check out the blog for the latest news on dbt's development and best practices