Closed djbelknapdbs closed 1 year ago
Hey,
I saw a similar issue reported on Slack and I think it has nothing to do with this package, nor should be fixed here. ~My assumption is that~ it's purely related to the usage of reserved words as identifiers.
Therefore an official solution would be to enable quoting: see recommendation for Snowflake here (not using reserved words - otherwise enable quoting): https://docs.getdbt.com/reference/project-configs/quoting
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
When a table name is a reserved word and you set the
generate_columns
parameter toTrue
, thegenerate_source
macro fails with an error. You can avoid this by setting quoting at the project level, but that's not recommended especially for Snowflake according to the docs. It's manageable to flip it on during development and back off.Seems related to #11.
Steps to reproduce
1) Create a table named
group
2) Leavequoting
unspecified inproject.yml
2) Run thegenerate_source
macro on the database/schema that includes thegroup
table andgenerate_columns=True
Expected results
Produce a source schema entry for the table, or fail more elegantly by skipping the table with a placeholder.
Actual results
The code fails with a Runtime Error - see the log output below.
Screenshots and log output
System information
The contents of your
packages.yml
file:Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using: Windows 10
The output of
python --version
:Additional context
I haven't fully traced it but I think it's happening in the call to
adapter.get_columns_in_relation
. The issue does not happen if you don't setgenerate_columns=True
.Are you interested in contributing the fix?
Possibly. If I do I'll need a nudge on how to solve the issue. Is there a way to override quoting within a macro?