Open martinshjung opened 1 year ago
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.
Describe the bug
I think this is similar to the resolved issue with
dbt_utils.star()
here: https://github.com/dbt-labs/dbt-utils/issues/605. I have a model usingunion_relations
, that references tables that haven't been built yet. I want to be able to run SQLFluff and lint my model, but I getFound unparsable section: 'select'
.Steps to reproduce
Create the model that uses
union_relation
. Important you passsource_column_name=None
, to trigger the parse error with SQLFluff:Without running any of these dbt models, run
sqlfluff lint
againstmodel3.sql
.Expected results
I'd expect the compiled SQL to have
*
in the SELECT statement, similar to how it's handled with thedbt_utils.star
macro.Actual results
I don't get any text after the SELECT keyword, resulting in a parse error with SQLFluff.
Screenshots and log output
I get:
with the compiled SQL looking like this:
System information
The contents of your
packages.yml
file:Which database are you using dbt with?
The output of
dbt --version
:Additional context
Using
sqlfluff
version2.3.1
, with the same versionsqlfluff-templater-dbt
.Are you interested in contributing the fix?
A snippet like this in the default macro, maybe?
Not sure what integration tests would be appropriate, since it's for
flags.WHICH == compile
.