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:
![](https://www.thedataschool.co.uk/content/images/2025/02/image-61.png)
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:
![](https://www.thedataschool.co.uk/content/images/2025/02/image-63.png)
Note - these sources can only be referenced within the models folder, where src_superstore.yml was also created.