dbt-labs / dbt-external-tables

dbt macros to stage external sources
https://hub.getdbt.com/dbt-labs/dbt_external_tables/latest/
Apache License 2.0
297 stars 119 forks source link

Snowflake External Table - Invalid column names when using numeric values #134

Closed aPeterHeise closed 7 months ago

aPeterHeise commented 2 years ago

Describe the bug

When using a numeric value as a column name in my external table, Snowflake throws a syntax error. There seems to be quoting missing in DBT for this column name.

Steps to reproduce

I have the following .yml file and use it with dbt run-operations: ` - name: external_table external: location: "@EXTERNAL_STAGE/folder/" columns:

Expected results

A created external table in Snowflake with a column "0".

Actual results

No table is created, Snowflake returns a Syntax error.

Screenshots and log output

11:55:23  2 of 4 START external source external_table
11:55:23  2 of 4 (1) create or replace external table <....>.external_table(       ...  
11:55:24  Encountered an error while running operation: Database Error
  001003 (42000): SQL compilation error:
  syntax error line 3 at position 57 unexpected '0'.
  syntax error line 3 at position 75 unexpected '0'.
jtcohen6 commented 2 years ago

@aPeterHeise Good call! Thanks for the quick fix over in #135. I think the mismatch in logic was just an oversight.

github-actions[bot] commented 7 months 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.