question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change to union_relations in 0.8.1 causes error about no columns being found

See original GitHub issue

Describe the bug

Today our activities model, which uses the union_relations macro, to stitch together a few models, has broken within our SQLFluff Github Action, with the following error:

TMP: dbt compilation error on file 'models/enrichment/en__activities.sql', There were no columns found to union for relations int__activities__customer_order_created, int__activities__non_customer_order_created, int__activities__order_adjusted, int__activities__order_line_created, int__activities__order_line_refunded

This error message looks like it was introduced in 0.8.1, which appears to amend how include and exclude works, but our model does not use these fields, here it is:

WITH
activities AS (
    {{ dbt_utils.union_relations(
        relations=[
            ref('int__activities__customer_order_created'),
            ref('int__activities__non_customer_order_created'),
            ref('int__activities__order_adjusted'),
            ref('int__activities__order_line_created'),
            ref('int__activities__order_line_refunded')
        ]
    ) }}
)
....

Steps to reproduce

With the following:

dbt_core==1.0.*
dbt_snowflake==1.0.*
sqlfluff-templater-dbt==0.9.*

and packages:

packages:
  - package: calogica/dbt_expectations
    version: 0.5.1

Create a model using union_relations, and try to compile the code

Expected results

The model should compile without issue

Actual results

The compile fails, stating that there are no columns found in the relations

System information

The contents of your packages.yml file:

  • package: calogica/dbt_expectations version: 0.5.1

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • [ x ] snowflake
  • other (specify: ____________)

The output of dbt --version:

installed version: 1.0.3
   latest version: 1.0.3

Up to date!

Plugins:
  - snowflake: 1.0.0 - Up to date!

Additional context

Looks related to this column_superset.keys() list from https://github.com/dbt-labs/dbt-utils/blob/main/macros/sql/union.sql#L64

Happy to share more info and screen grabs of our model and the underlying models, and from our github action as well (it’s basically running sqlfluff lint on changed files)

Are you interested in contributing the fix?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
joellabescommented, Mar 3, 2022

OK thanks! I’ve just released dbt_utils 0.8.2 which has a fix, so I’ll close this out. Sorry for the hassle all!

0reactions
GCluniescommented, Mar 2, 2022

@joellabes I ran into it while developing locally. Error surfaced when running dbt build -s +some_model --full-refresh

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixing ALTER TABLE errors with Flask-Migrate and SQLite
Any other change to columns or constraints is going to be rejected with an error. You can test this yourself very easily.
Read more >
Silent ORA-918 behavior change in RU 19.17.0 and newer
In this case let me explain the silent ORA-918 behavior change in RU ... ANSI joins may not raise an error for ambiguous...
Read more >
The monoliths in Utah, California, and Romania, explained - Vox
The monoliths are long vertical slabs of metal, each 10 to 12 feet tall. They appear with no warning and disappear just as...
Read more >
Less common applications of monoliths III. Gas chromatography
Also, monoliths do not require packing in the column. ... columns used for GC, the hydrophobic polymer-based packings were found to be more...
Read more >
Synthesis and Applications of Monolithic HPLC Columns
Silica and carbon monolithic columns were synthesized and modified for liquid ... No significant change has been found after the particles have been ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found