dbt data-diff's not using model's alias when generating the target table name #399
Description
Describe the bug
Data-Diff's new --dbt
command is not using the model's alias when deriving the target table name.
https://docs.getdbt.com/reference/resource-configs/alias
The standard behavior of dbt is:
If a custom alias is not specified, the identifier of the relation is the resource name (i.e. the filename).
If a custom alias is specified, the identifier of the relation is the {{ alias }} value.
Make sure to include the following (minus sensitive information):
dbt run -m gold_bi_contracts && data-diff --dbt
[22:10:16] ERROR - Snowflake: Table '**************.GOLD_BI.GOLD_BI_CONTRACTS' does not exist, or has no columns
Model gold_bi_contracts.sql
is configured with an alias
{{
config(
alias = 'contracts'
)
}}
Correct table target should be:
'**************.GOLD_BI.CONTRACTS'
Problem area:
https://github.com/datafold/data-diff/blob/master/data_diff/dbt.py#L106
Code needs to coalesce between alias
and name
Describe the environment
data-diff 0.4.0
(note, I looked at the change log for 0.4.1 and didn't see anything that would affect this)
dbt 1.3.0
Snowflake