Skip to content
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

[Regression] Ephemeral Materializations not Compiling correctly #8217

Closed
2 tasks done
JoshuaHuntley opened this issue Jul 26, 2023 · 4 comments · Fixed by #8215
Closed
2 tasks done

[Regression] Ephemeral Materializations not Compiling correctly #8217

JoshuaHuntley opened this issue Jul 26, 2023 · 4 comments · Fixed by #8215
Labels
bug Something isn't working regression

Comments

@JoshuaHuntley
Copy link

JoshuaHuntley commented Jul 26, 2023

Is this a regression in a recent version of dbt-core?

  • I believe this is a regression in dbt-core functionality
  • I have searched the existing issues, and I could not find an existing issue for this regression

Current Behavior

dbt 1.5.3 is compiling models with ephemeral materializations differently than 1.5.2 and is causing jobs to fail. See code examples:

---- Compiled with 1.5.3 ----

with __dbt__cte__table as (

WITH source AS (
    SELECT
        *
    FROM DATABASE.schema.table
),
renamed AS (
    SELECT
         col1::number(10,0) as col1
        ,col2::number(10,0) as col2
        ,col3::number(10,0) as col3
        ,upper(trim(col4)::varchar) as col4
        ,col5
    FROM source
)
SELECT
    *
FROM renamed
)
with source as (             --<-<-<-<-<-<-<-<-<-<-<-<-<-<- This part now fails
    select *
    from __dbt__cte__table
)
select * from source

Expected/Previous Behavior

Code sample from previous minor version:

---- Compiled with 1.5.2 ----

with  __dbt__cte__table as (

WITH source AS (
    SELECT
        *
    FROM DATABASE.schema.table
),
renamed AS (
    SELECT
         col1::number(10,0) as col1
        ,col2::number(10,0) as col2
        ,col3::number(10,0) as col3
        ,upper(trim(col4)::varchar) as col4
        ,col5
    FROM source
)
SELECT
    *
FROM renamed
),source as (
    select *
    from __dbt__cte__table
)
select * from source

Steps To Reproduce

Compile with 1.5.2 and compare to 1.5.3

Relevant log output

No response

Environment

- OS:  MacOS
- Python: 3.11.4
- dbt (working version): 1.5.2
- dbt (regression version): 1.5.3

Which database adapter are you using with dbt?

snowflake

Additional Context

No response

@JoshuaHuntley JoshuaHuntley added bug Something isn't working regression triage labels Jul 26, 2023
@github-actions github-actions bot changed the title [Regression] <title> [CT-2874] [Regression] <title> Jul 26, 2023
@JoshuaHuntley JoshuaHuntley changed the title [CT-2874] [Regression] <title> [Regression] Ephemeral Materializations not Compiling correctly Jul 26, 2023
@dataders
Copy link
Contributor

dataders commented Jul 26, 2023

thanks @JoshuaHuntley! This is a strange error to be sure. I looked at the diff (v1.5.2...v1.5.3) and couldn't distinguish any change what would affect this.

Can you share

  1. the output of dbt --version? does the version of dbt-snowflake change b/w each of these environments?
  2. the model files being used (both the ephemeral model and an example of a downstream model that ref's the ephemeral model?

@JoshuaHuntley
Copy link
Author

I compared these by compiling on my CLI after our PROD failure. Here is the out from both compile iterations:

15:58:03 Running with dbt=1.5.2 15:58:03 Registered adapter: snowflake=1.5.2 15:58:04 Found 15:58:04 15:58:06 Concurrency:

16:01:41 Running with dbt=1.5.3 16:01:41 Registered adapter: snowflake=1.5.2 16:01:41 Unable to do partial parsing because of a version mismatch 16:01:44 Found 16:01:45 16:01:46 Concurrency:

@gshank
Copy link
Contributor

gshank commented Jul 27, 2023

This is caused by a bug in sqlparse 0.4.4 for which we have just developed a fix in #8215

@dbeatty10
Copy link
Contributor

Closing as fixed by #8215, but we can re-open as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants