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

dbt-materialize: Stop adding aliases to subqueries with --empty #27522

Conversation

bobbyiliev
Copy link
Contributor

@bobbyiliev bobbyiliev commented Jun 7, 2024

Motivation

As per this bug here, the --empty flag doesn't work with relations that are aliased and fails.

A quick repro:

  • Create a simple model with: SELECT * FROM {{ ref('my_upstream_model')}} some_alias
  • The generated SQL when using the --empty flag, looks like this:
as (
  SELECT * FROM (
    select * from "my_upstream_model" where false limit 0) _dbt_limit_subq_my_upstream_model alias
);

Tips for reviewer

Checklist

@bobbyiliev bobbyiliev requested review from morsapaes and a team as code owners June 7, 2024 19:01
Copy link
Contributor

@benesch benesch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, good find.

@bobbyiliev bobbyiliev merged commit ef0130f into MaterializeInc:main Jun 7, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants