Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New snapshot configs #5817

Merged
merged 37 commits into from
Jul 25, 2024
Merged

New snapshot configs #5817

merged 37 commits into from
Jul 25, 2024

Conversation

matthewshaver
Copy link
Contributor

What are you changing in this pull request and why?

Closes #5805

[First round of updates]
Adds notes to the target_schema and target_database that the configs are optional
Snapshot page examples and tables updated with new examples and table configs

Checklist

Adding or removing pages (delete if not applicable):

  • 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

@matthewshaver matthewshaver requested a review from a team as a code owner July 22, 2024 14:36
Copy link

vercel bot commented Jul 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs-getdbt-com ✅ Ready (Inspect) Visit Preview Jul 25, 2024 7:27pm

@github-actions github-actions bot added the content Improvements or additions to content label Jul 22, 2024
@github-actions github-actions bot added Docs team Authored by the Docs team @dbt Labs size: medium This change will take up to a week to address labels Jul 22, 2024
| ------ | ----------- | --------- | ------- |
| Config | Description | Required? | Example |
| ------ | ----------- | --------- | ------- |
| [database] | The database that dbt should render the snapshot table into | No | analytics |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the target_database and target_schema pages no longer apply, is there anything specific we want to link to here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{{
config(
unique_key='id',
schema='snapshots', // optional config. If not defined, the snapshot will use the `generate_schema_name` macro.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

schema and database are the new configs that use the generate_schema_name / generate_database_name macros like other dbt resources

target_schema and target_database are the old configs

website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/docs/build/snapshots.md Show resolved Hide resolved

:::warning Legacy configuration

For environments on versionless dbt Cloud or dbt Core v1.9+, the `target_database` configuration is now optional. Best practices dictate that the `target_database` config should be removed from snapshots in the environment, in which case the snapshots will instead utilize the `generate_database_name` macro by default. Project snapshots configured with `target_schema` will continue to work as expected.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe target_database has always been optional

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

:::

</VersionBlock>

Snapshots build into the same `target_schema`, no matter who is running them.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just remove this page all-together? This information is now out-dated

@graciegoheen
Copy link
Collaborator

@graciegoheen
Copy link
Collaborator

Can we also make some updates to this page:
Screenshot 2024-07-22 at 8 50 50 AM

Screenshot 2024-07-22 at 8 51 09 AM

@graciegoheen graciegoheen requested a review from dbeatty10 July 22, 2024 14:55
@gshank
Copy link

gshank commented Jul 22, 2024

I think the doc changes are more work than the code changes were :). Looks like Grace has this pretty much handled.

@dbeatty10
Copy link
Contributor

I think the doc changes are more work than the code changes were :). Looks like Grace has this pretty much handled.

😂

@graciegoheen
Copy link
Collaborator

I think it may also be worth calling this out in a release note? Thoughts?

Copy link
Contributor

@nghi-ly nghi-ly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! left some minor nits

website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/reference/resource-configs/database.md Outdated Show resolved Hide resolved
website/docs/reference/resource-configs/schema.md Outdated Show resolved Hide resolved
website/docs/reference/resource-configs/target_database.md Outdated Show resolved Hide resolved

</File>

6. Run the `dbt snapshot` [command](/reference/commands/snapshot) &mdash; for our example, a new table will be created at `analytics.snapshots.orders_snapshot`. The `schema` config will utilize the `generate_schema_name` macro.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we link to this page for the schema config mention https://docs.getdbt.com/reference/resource-configs/schema

website/docs/docs/build/snapshots.md Show resolved Hide resolved
website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
website/docs/docs/build/snapshots.md Outdated Show resolved Hide resolved
</File>

</VersionBlock>

#### Snapshot Configuration

| Option | Description | Required? |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this table? It seems duplicative of the other table here -> https://docs.getdbt.com/docs/build/snapshots#snapshot-configurations

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, can remove and link to snapshots page instead!


<VersionBlock lastVersion="1.8">

Available for versionless dbt Cloud or dbt Core v1.9+. Select v1.9 or newer from the version dropdown to view the configs.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirming are we calling this "versionless" or "Keep on latest version"? cc: @jtcohen6

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question - we went back earlier this quarter and added "versionless" in front of every mention of "Keep on latest version" in the docs to tie the two ideas together but I'll defer to Jerco about how to handle the naming going forward

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh if that's already added, then that works for me!

@@ -4,6 +4,12 @@ description: "Target_database - Read this in-depth guide to learn about configur
datatype: string
---

:::note

For [versionless](/docs/dbt-versions/core-upgrade/upgrading-to-v1.8#keep-on-latest-version) dbt Cloud accounts and dbt Core v1.9+, this functionality is no longer utilized. Use the [database](/reference/resource-configs/database) config as an alternative to define a custom database while still respecting the `generate_database_name` macro.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question on "versionless"


<VersionBlock lastVersion="1.8">

Available for versionless dbt Cloud or dbt Core v1.9+. Select v1.9 or newer from the version dropdown to view the configs.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question on "versionless"

@@ -4,6 +4,12 @@ description: "Target_schema - Read this in-depth guide to learn about configurat
datatype: string
---

:::note

For [versionless](/docs/dbt-versions/core-upgrade/upgrading-to-v1.8#keep-on-latest-version) dbt Cloud accounts and dbt Core v1.9+, this functionality is no longer required. Use the [schema](/reference/resource-configs/schema) config as an alternative to define a custom schema while still respecting the `generate_schema_name` macro.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question on "versionless"

@graciegoheen
Copy link
Collaborator

graciegoheen commented Jul 24, 2024

Can we also make some updates to this page: Screenshot 2024-07-22 at 8 50 50 AM

Screenshot 2024-07-22 at 8 51 09 AM

^ @matthewshaver just want to make sure we get these updates in as well!

Replacing table with link
Copy link
Collaborator

@graciegoheen graciegoheen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all of the work on this!

@matthewshaver matthewshaver enabled auto-merge (squash) July 25, 2024 19:20
@matthewshaver matthewshaver merged commit b08aff4 into current Jul 25, 2024
10 checks passed
@matthewshaver matthewshaver deleted the snapshots branch July 25, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs size: large This change will more than a week to address and might require more than one person
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[dbt-core issue #10301] snapshots now can optionally respect generate schema/database/alias macros
5 participants