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

[Core] New snapshot_meta_column_names config for dbt snapshots #6112

Closed
FishtownBuildBot opened this issue Sep 20, 2024 · 3 comments · Fixed by #6211
Closed

[Core] New snapshot_meta_column_names config for dbt snapshots #6112

FishtownBuildBot opened this issue Sep 20, 2024 · 3 comments · Fixed by #6211
Assignees
Labels
content Improvements or additions to content dbt Core The changes proposed in this issue relate to dbt Core dbt-core v1.9 improvement Use this when an area of the docs needs improvement as it's currently unclear

Comments

@FishtownBuildBot
Copy link

FishtownBuildBot commented Sep 20, 2024

At a minimum, update body to include a link to the page on docs.getdbt.com requiring updates and what part(s) of the page you would like to see updated.
Originating from this issue: dbt-labs/dbt-core#10185
Pull request: dbt-labs/dbt-core#10608

@runleonarun runleonarun added content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear dbt Core The changes proposed in this issue relate to dbt Core labels Sep 20, 2024
@nataliefiann
Copy link
Contributor

@graciegoheen
Copy link
Collaborator

graciegoheen commented Sep 25, 2024

We should:

  • add a page for the new snapshot config snapshot_meta_column_names which can be used to customize the names of the snapshot meta-fields created by dbt internally to satisfy my org’s naming conventions
  • add a callout to our section about these meta fields that you can customize the names using this new config

Note:

  • 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.

Here's an example of the new config:

{{
    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
      }
    )
}}

You can also set this in your dbt_project.yml like:

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
    }

@graciegoheen
Copy link
Collaborator

Hi @nataliefiann I see this is "in review", but I don't see a PR linked. Lemme know when you're ready for me to take a look!

@graciegoheen graciegoheen changed the title [Core] Docs Changes Needed from dbt-core Issue #10185 [Core] dbt-core Issue #10185 - new snapshot_meta_column_names config for dbt snapshots Sep 25, 2024
@dbeatty10 dbeatty10 self-assigned this Sep 30, 2024
@dbeatty10 dbeatty10 changed the title [Core] dbt-core Issue #10185 - new snapshot_meta_column_names config for dbt snapshots [Core] dbt-core Issue #10185 - new snapshot_meta_column_names config for dbt snapshots Sep 30, 2024
@dbeatty10 dbeatty10 changed the title [Core] dbt-core Issue #10185 - new snapshot_meta_column_names config for dbt snapshots [Core] New snapshot_meta_column_names config for dbt snapshots Sep 30, 2024
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 dbt Core The changes proposed in this issue relate to dbt Core dbt-core v1.9 improvement Use this when an area of the docs needs improvement as it's currently unclear
Projects
None yet
5 participants