-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[CT-2561] [Bug] dbt model referencing an ephemeral model results in broken compiled SQL code #7595
Comments
@MauroLuzzatto I believe this is a duplicate of #7396 (and #7521). Could you check the installed version of
I'm guessing it's
We've also struggled to reliably reproduce this error — it seems to vary based on operating system. If you manage to do any more digging, could you weigh into #7515 (issue to resolve the root cause going forward)? |
@jtcohen6 Thank you very much for the quick replay! So far, I have only seen the errors on
And not in any local development environment:
However, that might also be connected to the fact that the dbt and other modules are installed there (CI and deployment) on every run. I have also seen the error disappearing after retriggering the GHA run. |
All of this is really useful troubleshooting information for us about I added this comment summarizing your findings so far: #7515 (comment) Thanks again for reporting this issue. I'm going to close this in favor of #7515. Much appreciated if you are able to share in that issue anything else you find find out the error. |
New fix in #8215 |
Is this a new bug in dbt-core?
Current Behavior
When running a dbt model that references an ephemeral model, the resulting compiled SQL code created by dbt contains an error.
Specifically, the ephemeral CTE is followed by a “with” statement instead of a comma, which causes a “Syntax error”.
Example of the incorrect compiled dbt model code:
This results in a Syntax error (which is expected):
This error appeared during an airflow run using a docker image using the
python:3.8-slim-bullseye
base. It also appeared for other models following the same structure of referencing an ephemeral model during GHA runs (Ubuntu: 22.04.2 LTS distribution). However, we could not reproduce the error in our local environment with a macOS Ventura Version 13.3.1 (22E261) OS.The dbt packages had the same versions in all of the environments.
Expected Behavior
Generate correct SQL with a comma instead of a “with” statement
Example of the correct code:
Steps To Reproduce
We were struggling to reproduce the error in all our environments. We could see it appearing for the same model codes in GHA running on Ubuntu: 22.04.2 LTS OS and on airflow using a docker image using the
python:3.8-slim-bullseye
base.The reoccurring pattern of the errors that the models were referencing ephemeral models and that the compiled SQL code contained the same error with the erroneous “with” statement.
Docker:
python:3.8-slim-bullseye
GHA:
Ubuntu: 22.04.2 LTS
Requirements:
Ephemeral model code (
my_ephemeral_model.sql
):dim_model
example model code:Run
dbt run -s dim_table --full-refresh --defer --state manifest
See error
Relevant log output
Environment
Which database adapter are you using with dbt?
bigquery
Additional Context
noresponse
The text was updated successfully, but these errors were encountered: