Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

dbt: Missing column specification

with uuid_generation AS 
(select uuid_string() as uuid)
select metadata$filename,
               to_timestamp_ntz(current_timestamp()),
               md.$1
        from @S3/table/prod/ (file_format => STG.XML, pattern =>'^((?!archive).)*$') md cross join uuid_generation

This snippet works perfectly fine in snowflake (dbeaver). However, when I put it in a dbt model, I get this error:

Missing column specification

I also tried this:

with uuid_generation AS 
(select uuid_string() as uuid)
select metadata$filename,
               to_timestamp_ntz(current_timestamp()),
               md.$1 as "$1"
        from @S3/table/prod/ (file_format => STG.XML, pattern =>'^((?!archive).)*$') md cross join uuid_generation

but I get the same error

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You need to provide a column name for aggregated or derived columns due to dbt. Also unquoted column names need to start with letters or underscore: https://docs.snowflake.com/en/sql-reference/identifiers-syntax.html

with uuid_generation AS 
(select uuid_string() as uuid)
select metadata$filename,
to_timestamp_ntz(current_timestamp()) as your_timestamp,
md.$1 as "$1"
from @S3/ivw_competitors/prod/ (file_format => STG.XML, pattern
=>'^((?!archive).)*$') md cross join uuid_generation
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading