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

Errors on `--empty´ Flag run #339

Open
1 of 3 tasks
marvingeerken opened this issue Jan 23, 2025 · 0 comments
Open
1 of 3 tasks

Errors on `--empty´ Flag run #339

marvingeerken opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working triage

Comments

@marvingeerken
Copy link

marvingeerken commented Jan 23, 2025

Describe the bug

Several statements use the {{ source() }} macro to gather the name of the table/pipe.
When running our external tables/pipe on the CI, we use the --empty flag.
Here the source name gets overridden by sub-select using where false limit 0.
Hence all these statements raises compilation errors.

Example:
create or replace table (select * from db.schema.name where false limit 0)

The dbt documentation recommends to use .render() for such cases: https://docs.getdbt.com/reference/commands/build#the-render-method

To have a proper, automated deployment we execute the stage_external_sources() macro as a pre_hook of the downstream staging model.
Thats why we have just one command with the additional empty flag.

Steps to reproduce

  1. Create snowpipe via yaml definition
  2. Create a sql model on top
  3. Add a pre_hook executing the snowpipe
  4. Run the model adding the --empty flag

Expected results

Actual results

Screenshots and log output

System information

The contents of your packages.yml file:

Which database are you using dbt with?

  • redshift
  • snowflake
  • other (specify: ____________)

The output of dbt --version:
dbt Cloud latest

The operating system you're using:

The output of python --version:

Additional context

@marvingeerken marvingeerken added bug Something isn't working triage labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant