You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
Dbt errors when combining an incremental model with time_ingestion_partitioning enabled and also enforcing model contract constraints.
I'd love to know whether this is intended or if this is potentially a bug that could be worked on :)
Expected Behavior
Dbt should not error out on columns 'consumed' by the time_ingestion_partitioning flags that are in the dbt model but not factually in the output schema or BigQuery table when enforcing model contract constraints.
The partitioning column should not have 'presence enforcement' when this flag is enabled (ideally).
Steps To Reproduce
# incremental_test.sql
{{ config(
materialized="incremental",
on_schema_change="fail",
partition_by={
"field": "created_date",
"data_type": "timestamp",
"granularity": "day",
"time_ingestion_partitioning": true,
}
) }}
SELECT
'A' AS letter,
1 AS digit,
CURRENT_DATE() AS created_date
and subsequently building with dbt build --select incremental_test I get the error attached in the log output.
Relevant log output
This model has an enforced contract that failed.
Please ensure the name, data_type, and number of columns in your contract match the columns in your model's definition. | column_name | definition_type | contract_type | mismatch_reason | | ------------ | --------------- | ------------- | ------------------- | | created_date | DATE | | missing in contract |
Hello @LennartKloppenburg ! It looks like you have found a specific bug. Quoting Jeremey
This BQ issue is a pretty specific case, at the intersection of
model contracts
the (BQ-only) time_ingestion_partitioning config
In the example the user provides, technically the created_date column is returned by the model's query, but it's not included in the actual table produced by the model, because it's used as the pseudo-column for ingestion-time partitioning.
We think a workaround is if you added created_date to your yaml contract. Could you try that and let us know if it works?
Hi @amychen1776 sorry, your reply was lost during the Christmas holidays :) Thanks a lot for getting back to me! I will give this a go and let you know :) I remember trying something like this but encountering a different error, but let me verify that for you.
Is this a new bug in dbt-bigquery?
Current Behavior
Dbt errors when combining an incremental model with
time_ingestion_partitioning
enabled and also enforcing model contract constraints.I'd love to know whether this is intended or if this is potentially a bug that could be worked on :)
Expected Behavior
Dbt should not error out on columns 'consumed' by the
time_ingestion_partitioning
flags that are in the dbt model but not factually in the output schema or BigQuery table when enforcing model contract constraints.The partitioning column should not have 'presence enforcement' when this flag is enabled (ideally).
Steps To Reproduce
When enforcing the data contract like so:
and subsequently building with
dbt build --select incremental_test
I get the error attached in the log output.Relevant log output
Additional Context
No response
The text was updated successfully, but these errors were encountered: