Description
Describe the bug
I was successfully using the macro union_relations with the optional exclude parameter. However when I switched to using include I received the error 'SQL compilation error:
syntax error line 19 at position 12 unexpected 'from'.'
When I opened the compiled file I noticed that the compiled SQL wasn't selecting any of the columns I listed in the include paramater. It was only selecting the source model followed by a comma and the from statement thus triggering the SQL error. It appears the macro is not working as intended.
Steps to reproduce
Create a model using the union_relations macro and use the optional "include" parameter. List columns in the include parameter. I also renamed my source column, but I'm not sure if that is related to the bug.
Expected results
I would expect all columns listed in the include parameter array to be in each select statement and not end in a comma before the from causing a syntax error.
Actual results
The macro is not calling any columns, but the source model column. I've confirmed these columns do exist in my underlying ref models and can query them from those tables in Snowflake.
Screenshots and log output
Here is a screenshot of my model script:
Here is a screenshot of part of the compiled script
Here is a screenshot of the error:
System information
The contents of your packages.yml
file:
Which database are you using dbt with?
- postgres
- redshift
- bigquery
- [ X] snowflake
- other (specify: ____________)
The output of dbt --version
:
installed version: 0.17.0
latest version: 0.17.2
Your version of dbt is out of date! You can find instructions for upgrading here:
https://docs.getdbt.com/docs/installation
Plugins:
- bigquery: 0.17.0
- snowflake: 0.17.0
- redshift: 0.17.0
- postgres: 0.17.0
The operating system you're using:
MacOS Mojave Version 10.14.6
The output of python --version
:
Python 3.7.7
**Contents of packages:: **
- package: fishtown-analytics/dbt_utils
version: 0.5.1
Additional context
Are you interested in contributing the fix?
No, going on extended leave in a few weeks
Activity