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-2380] [Bug] Referencing Ephemeral SQL Models Fails in Python #7288
Comments
Thanks for reporting this @ernestoongaro ! I got the same results as you when I tried the same thing in dbt-duckdb. There's two main options for resolving this:
Option 1I'm not sure if there's an easy path to support referencing ephemeral nodes from dbt python models or not. Lots of juicy details in the Compiler class of how ephemeral models are injected as a CTE into SQL models (and apparently Python models as well 😬 ). Option 2If it's non-trivial to add support for Python, one idea would be to proactively raise as an error in the meantime to say that referencing ephemeral models isn't supported. Maybe add something like this somewhere around here:
Of course we'd want to add an explanation within docs.getdbt.com as well if we choose Option 2. |
Option 2 makes sense to me in the shorter term! We do something similar within the dbt-core/core/dbt/context/providers.py Lines 495 to 510 in fe62ab8
I don't think it would make sense to have a custom |
PR to update the docs (thanks @ernestoongaro!!) |
Bug report here: dbt-labs/dbt-core#7288 --------- Co-authored-by: Leona B. Campbell <3880403+runleonarun@users.noreply.github.com> Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers. |
Marking as un-stale because there's an open PR and it also has a recent comment: #9196 (comment) |
Is this a new bug in dbt-core?
Current Behavior
Doing this writes the SQL directly into the Python file and fails fairly miserably
Expected Behavior
Ideally it would be good support this, or give a compilation error vs trying to send invalid python down
Steps To Reproduce
select 1 as test
, save it asmy_ephemeral_sql_model.sql
Relevant log output
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
No response
The text was updated successfully, but these errors were encountered: