Setting up Snowflake sources in dbt

This blog is going to outline how to create sources in dbt that allow you to easily reference tables that are stored in Snowflake. We will be connecting to two tables - orders and orders_returned. The tables sit in the schema zr_superstore_schema.

Pre-requisites:

  • Have a dbt project that is connected to your Snowflake account (I don't go into this in this blog, but this should be configured in the Credentials section within the Your Profile section in dbt).

Step-by-step:

1) Within the models folder in your dbt project, create a folder called sources. This is not essential, but is best practice for organising your dbt project. Create a file called src_superstore.yml.

2) src_superstore.yml is where we will set up our sources. The file should be configured as follows:

3) Save src_superstore.yml.

4) Now we can easily reference the orders and orders_returned tables using {{ source('superstore', 'orders') }} and {{ source('superstore', 'returns') }}, for example with the query:

Note - these sources can only be referenced within the models folder, where src_superstore.yml was also created.

Author:
Zoe Reed
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab