during CI github action/workflow does:
run --empty --full-refresh in databricks workspace
this causes an error in the generated CTE sql, whereby a cte alias is also aliased because of the model’s sql having for example LEFT JOIN {{ ref(‘modelname’) }} ls
I do not have this double alias issue in local development, because NOT using --empty, for local development(I want a populated table to check).
Q. Is this a dbt bug(please confirm) as I would rather not have to code a work-around for this?
What does fix this issue is to create CTE select * from, for each ref(modelname) then you can use the CTE name in a join and alias it.
dbt core version 1.8.7 databricks 1.8.7
run model generated code errors (two aliases for cte???)
FROM source_data s
LEFT JOIN (select * from `dev`.`dataschema`.`location` where false limit 0) _dbt_limit_subq_location ls
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^^^
ON s.codeid = ls.codeid
model sql snippet:
FROM source_data s
LEFT JOIN {{ ref('location') }} ls
ON s.codeid = ls.codeid