-
Notifications
You must be signed in to change notification settings - Fork 975
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
Snapshot config to define column names #6146
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
- When you run your snapshots, dbt handles the renames from `example_valid_from` to `test_valid_from` for you. | ||
|
||
You can read through the section on [Defining column names](/docs/build/snapshots#define-column-names-in-snapshot-table) for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the link doesn't take me to the right place? or for some reason i didn't see the 'define column names' section?
Co-authored-by: Mirna Wong <[email protected]>
Co-authored-by: Mirna Wong <[email protected]>
|
||
```yml | ||
|
||
snapshots: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the full example from the issue!
snapshots:
my_project:
+snapshot_meta_column_names={
dbt_valid_from: start_date,
dbt_valid_to: end_date,
dbt_scd_id: scd_id,
dbt_updated_at: updated_date
}
|
||
Use the following configuration to define the names of the columns created in the [snapshot table](/docs/build/snapshots#snapshot-meta-fields). | ||
|
||
<File name='dbt_project.yml'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's also show the example from the issue on how to do this in the config block:
{{
config(
target_database='analytics',
target_schema='snapshots',
unique_key='id',
strategy='timestamp',
updated_at='updated_at',
snapshot_meta_column_names={
dbt_valid_from: start_date,
dbt_valid_to: end_date,
dbt_scd_id: scd_id,
dbt_updated_at: updated_date
}
)
}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have some tab thing for other examples so you can see how to write a config in different places
</File> | ||
|
||
- When you run your snapshots, dbt handles the renames from `dbt_valid_from` to `example_valid_from` for you. | ||
- If you make subsequent updates to the config to rename the column, dbt manages the migration of column names for each configuration change. For example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not true.
See issue -> #6112 (comment)
we aren't doing anything for migration, so if a user renames the columns for a snapshot without updating an existing table, they will get an error. The recommendation is to use these settings for new snapshots, or to arrange to update their existing tables prior to committing a column name change.
|
||
</File> | ||
|
||
- When you run your snapshots, dbt handles the renames from `example_valid_from` to `test_valid_from` for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above - this is not true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments - I think this needs more work. Please see docs issue for examples to include and callout that we do not handle the migration -> #6112 (comment)
Co-authored-by: Grace Goheen <[email protected]>
Co-authored-by: Grace Goheen <[email protected]>
Closed off as Core project has been paused |
I've created this PR / added section to highlight new config allows users to define column names following this Git issue: https://github.com/orgs/dbt-labs/projects/14/views/35?pane=issue&itemId=80581863
Resolves #6112
What are you changing in this pull request and why?
Checklist