Skip to content

Commit dc911a3

Browse files
authored
remove snapshot query best practices--not relevant anymore for 1.9 and beyond (#6448)
## What are you changing in this pull request and why? <!-- Describe your changes and why you're making them. If related to an open issue or a pull request on dbt Core or another repository, then link to them here! To learn more about the writing conventions used in the dbt Labs docs, see the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md). --> The Snapshot Query best practices page feels out of date to me mentioning things like "avoid joins in your query" , "include as many columns as possible", etc. Given that there's already a configs best practice above this section, it feels like this section should get deleted altogether. ## Checklist - [ ] I have reviewed the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines. - [ ] The topic I'm writing about is for specific dbt version(s) and I have versioned it according to the [version a whole page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version) and/or [version a block of content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content) guidelines. - [ ] I have added checklist item(s) to this list for anything anything that needs to happen before this PR is merged, such as "needs technical review" or "change base branch." - [ ] The content in this PR requires a dbt release note, so I added one to the [release notes page](https://docs.getdbt.com/docs/dbt-versions/dbt-cloud-release-notes). <!-- PRE-RELEASE VERSION OF dbt (if so, uncomment): - [ ] Add a note to the prerelease version [Migration Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/docs/dbt-versions/core-upgrade) --> <!-- ADDING OR REMOVING PAGES (if so, uncomment): - [ ] Add/remove page in `website/sidebars.js` - [ ] Provide a unique filename for new pages - [ ] Add an entry for deleted pages in `website/vercel.json` - [ ] Run link testing locally with `npm run build` to update the links that point to deleted pages -->
1 parent 63c55da commit dc911a3

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

website/docs/docs/build/snapshots.md

-23
Original file line numberDiff line numberDiff line change
@@ -390,29 +390,6 @@ snapshots:
390390

391391
</VersionBlock>
392392

393-
## Snapshot query best practices
394-
395-
This section outlines some best practices for writing snapshot queries:
396-
397-
- #### Snapshot source data
398-
Your models should then select from these snapshots, treating them like regular data sources. As much as possible, snapshot your source data in its raw form and use downstream models to clean up the data
399-
400-
- #### Use the `source` function in your query
401-
This helps when understanding <Term id="data-lineage">data lineage</Term> in your project.
402-
403-
- #### Include as many columns as possible
404-
In fact, go for `select *` if performance permits! Even if a column doesn't feel useful at the moment, it might be better to snapshot it in case it becomes useful – after all, you won't be able to recreate the column later.
405-
406-
- #### Avoid joins in your snapshot query
407-
Joins can make it difficult to build a reliable `updated_at` timestamp. Instead, snapshot the two tables separately, and join them in downstream models.
408-
409-
- #### Limit the amount of transformation in your query
410-
If you apply business logic in a snapshot query, and this logic changes in the future, it can be impossible (or, at least, very difficult) to apply the change in logic to your snapshots.
411-
412-
Basically – keep your query as simple as possible! Some reasonable exceptions to these recommendations include:
413-
* Selecting specific columns if the table is wide.
414-
* Doing light transformation to get data into a reasonable shape, for example, unpacking a <Term id="json" /> blob to flatten your source data into columns.
415-
416393
## Snapshot meta-fields
417394

418395
Snapshot <Term id="table">tables</Term> will be created as a clone of your source dataset, plus some additional meta-fields*.

0 commit comments

Comments
 (0)