dstroot / dbt-example-snowflake

Example of using dbt with Snowflake (dbt's Jaffle Shop example)

Home Page:https://docs.page/dstroot/dbt-example-snowflake

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to your new dbt project!

Using the starter project

Try running the following commands:

  • dbt run
  • dbt test

Resources

Staging data

Subdirectories should be based on the source system. Our internal transactional database is one system, the data we get from Stripe's API is another, and lastly the events from our Snowplow instrumentation. We've found this to be the best grouping for most companies, as source systems tend to share similar loading methods and properties between tables, and this allows us to operate on those similar sets easily.

File Naming

File names. Creating a consistent pattern of file naming is crucial in dbt. File names must be unique and correspond to the name of the model when selected and created in the warehouse. We recommend putting as much clear information into the file name as possible, including a prefix for the layer the model exists in, important grouping information, and specific information about the entity or transformation in the model.

✅ stg_[source][entity]s.sql - the double underscore between source system and entity helps visually distinguish the separate parts in the case of a source name having multiple words. For instance, google_analyticscampaigns is always understandable, whereas to somebody unfamiliar google_analytics_campaigns could be analytics_campaigns from the google source system as easily as campaigns from the google_analytics source system. Think of it like an oxford comma, the extra clarity is very much worth the extra punctuation.

✅ Plural. SQL, and particularly SQL in dbt, should read as much like prose as we can achieve. We want to lean into the broad clarity and declarative nature of SQL when possible. As such, unless there’s a single order in your orders table, plural is the correct way to describe what is in a table with multiple rows.

About

Example of using dbt with Snowflake (dbt's Jaffle Shop example)

https://docs.page/dstroot/dbt-example-snowflake