using dbt-databricks 1.8.3 and dbt-core 1.8.3 command line
dbt run --empty --full-refresh
I am getting a SQL syntax error and when I check out the target generated code it is clear that the generated code has not considered an existing alias has already been used in the model sql?
select ....
from {{source(name,tablename)}} my_aliasname
dbt run --empty
select ...
from (select * from tablename where false limit 0) _dbt_limit_subq_tablename my_aliasname
there are two aliases now in the from statement ‘_dbt_limit_subq_tablename’ and ‘my_aliasname’?
Trying to use schema-only dry run
Work around is CTEs
WITH
sel_tab01 AS ( SELECT * FROM {{ ref(‘tablename01’) }} )
,sel_tab02 AS ( SELECT * FROM {{ source(‘name’, ‘tablename02’) }} )
,sel01 AS (SELECT …
FROM sel_tab01 tab01
JOIN sel_tab02 tab02 ON tab02.flightid = tab01.flightid
)
Some example code or error messages
sql syntax error (can’t have a select statment with two aliases, one is allowed as per SQL syntax.