-
Notifications
You must be signed in to change notification settings - Fork 122
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 snapshot_meta_column_names
Returns a Compilation Error on the Second dbt snapshot
Invocation
#887
Comments
Not certain this will help, but since we're on code freeze until Jan 6, it's the best suggestion I have: snapshots:
- name: customers_snapshot
relation: ref('stg_customers')
config:
strategy: check
unique_key: [id]
check_cols: [id]
snapshot_meta_column_names:
dbt_valid_from: "`_scd_valid_from`"
dbt_valid_to: "`_scd_valid_to`"
dbt_scd_id: "`_scd_id`"
dbt_updated_at: "`_scd_updated_att`"
dbt_is_deleted: "`_scd_is_deleted`" I've been moving to using backticks more liberally because there are places I don't have access to the 'quote' attribute from columns, but I need to quote columns in order to support names with otherwise unaccepted symbols. In dbt, they are doing exact match, so my hope is that this will pass the check. |
Other dbt-core users on dbt-datbricks have also reported this issue, as you can see in the cases referenced just above. At root, this is happening because dbt-databricks has not yet been modified to account for recent changes to snapshots. Compare the implementation in dbt-databricks (here) with the corresponding implementation in the base adapter (here). Note that dbt-databricks is using an older version of the snapshot validation function, and does not pass the column dictionary mapping meta columns to custom names. Resolving this issue will require using the newer function, and reviewing dbt-databricks' implementation against the recent snapshot changes to ensure that meta columns are handle correctly elsewhere as well. |
I've replaced this line with this:
I believe this issue will be resolved once this MR gets merged. (thanks @benc-db) |
Yeah, I missed that 1.9 final from dbt included these new snapshot behaviors, so the PR from yesterday is to remedy that. |
Describe the bug
The dbt documentation (snapshot_meta_column_names) describes the
snapshot_meta_column_names
config to be used to customize the names of the metadata columns within each snapshot available fordbt=1.9
.In
databricks=1.9.1
, the snapshot configsnapshot_meta_column_names
completes successfully on first dbt snapshot invocation.On the second dbt snapshot invocation, it will return a compilation error like below.
Steps To Reproduce
customers_snapshot.yml
dbt snapshot
. In this case, I rundbt snapshot --select customers_snapshot --log-level debug
.See attached log for the first run.
dbt snapshot
. The second run should error out.See attached log for the second run.
Expected behavior
The second dbt snapshot run should return successfully. No compilation error due to missing configured columns.
Screenshots and log output
dbt snapshot
dbt_snapshot_1_databricks.log
dbt snapshot
.dbt_snapshot_2_databricks.log
System information
The output of
dbt --version
:The operating system you're using: macOS Sequoia Version 15.2
The output of
python --version
: Python 3.12.7Additional context
The
dbt-snowflake
adapter completes successfully for bothdbt snapshot
run. See below logs.dbt_snapshot_1_snowflake.log
dbt_snapshot_2_snowflake.log
The text was updated successfully, but these errors were encountered: