• 8. 2. 2024
  • Ing. Jan Zedníček - Data Engineer & Controlling
  • 0

Is Dbt compatible with Snowflake? Definitely! And if you combine it with some ETL/orchestration tool like Keboola (cloud) or Mage.ai (on-premises), you’ve got yourself a decent data solution. Nowadays, most ETL frameworks (at least the better ones) integrate with dbt.

Local Configuration of Dbt and Snowflake

In this tutorial, we assume that dbt is installed locally and configured with a Snowflake database. The process consists of several steps:

Step 1 – Installation of dbt-core and Snowflake adapter – by running the command “pip install dbt-snowflake“. This will install dbt-core and the Snowflake adapter necessary for communication with the database.

Step 2 – Creation of a dbt project – there are 2 options: either create an empty project or use one already in Git.

  • For an empty project – navigate in the terminal to the desired location for the project and run the command “dbt init”.
  • For an existing project – perform a git clone of your project from an existing dbt Git repository.

dbt snowflake installation

When creating a new project, you’ll be prompted to provide a project name and adapter (choose Snowflake). This will create a new dbt project.

Step 3 – Configuration of profiles.yml and dbt_project.yml files – documentation on how the configuration in profiles.yml should look like can be found here. Alternatively, modify the template below (fill in your credentials).

type: snowflake
account: vxmpcpy-XXXXXXX
# User/password auth
user: DBT_USER
password: XXXXXXXXX
role: DBT_ROLE
database: DBT_DATABASE
warehouse: DBT_WAREHOUSE
schema: DBT

profiles.yml dbt snowflake

Step 4 – Configuration testing via “dbt debug” was successful, and we can see that all tests passed.

dbt debug snowflake

Step 5 – Running dbt via “dbt run” and checking the data directly in Snowflake. 2 default objects are processed (my_first_dbt_model.sql and my_second_dbt_model.sql).

The data was successfully delivered to the Snowflake database DBT_DATABASE.

Rate this post

Ing. Jan Zedníček - Data Engineer & Controlling

My name is Jan Zedníček and I have been working as a freelancer for many companies for more than 10 years. I used to work as a financial controller, analyst and manager at many different companies in field of banking and manufacturing. When I am not at work, I like playing volleyball, chess, doing a workout in the gym.

🔥 If you found this article helpful, please share it or mention me on your website

Leave a Reply

Your email address will not be published. Required fields are marked *