CSV Failed to upload to DB

The problem I’m having

I am new to dbt and currently I using dbt power user.
I am trying to upload a csv file to my DB (in SnowFlake), via “dbt seed” command

The CSV is prepared via python:
name = r’\report_’ + current_date.strftime(‘%Y%m%d’) + csv
file_name = path + name
df.to_csv(file_name, index=False)

The error :
1 of 1 START seed file product_finance.finance_report_20240616 … [RUN]
09:29:09 1 of 1 ERROR loading seed file product_finance.finance_report_20240616 … [ERROR in 3.46s]
09:29:09
09:29:09 Finished running 1 seed in 0 hours 0 minutes and 7.30 seconds (7.30s).
09:29:09
09:29:09 Completed with 1 error and 0 warnings:
09:29:09
09:29:09 Database Error in seed finance_report_20240616 (seeds\finance_report_20240616.csv)
001003 (42000): SQL compilation error:
syntax error line 1 at position 362 unexpected ‘Name’.
syntax error line 1 at position 402 unexpected ‘Type’.
syntax error line 1 at position 426 unexpected ‘text’.
syntax error line 1 at position 430 unexpected ‘,’.
syntax error line 1 at position 438 unexpected ‘Type’.
syntax error line 1 at position 447 unexpected ‘,’.
syntax error line 1 at position 454 unexpected ‘text’.
syntax error line 1 at position 465 unexpected ‘text’.
syntax error line 1 at position 485 unexpected ‘text’.
syntax error line 1 at position 503 unexpected ‘date’.
syntax error line 1 at position 528 unexpected ‘text’.
syntax error line 1 at position 532 unexpected ‘)’.
09:29:09
09:29:09 Done. PASS=0 WARN=0 ERROR=1 SKIP=0 TOTAL=1

What I’ve already tried

I removed any spaces from the file_name

Thanks

Hey @snirw_px, I believe the default seeding behaviour for Snowflake is that field names won’t be quoted which could be causing the syntax issues here. Have you tried updating your dbt_project.yml file to add:

seeds:
  +quote_columns: true

and seeing if that helps?

More info here: quote_columns | dbt Developer Hub

Thanks work like charm :slight_smile:

  • Is there any limitation is CSV size?
  • other files was also uploaded this files were deleated (from the seed folder) how it’s possible?

Thanks

Hey @snirw_px, glad to hear! :slight_smile:

In terms of size limits, not that I’m aware of. However, seeds shouldn’t be used for ingestion of large data sets - they’re more for adding supplementary information such as static lookups that don’t tend to change often, as these are also committed and version controlled. See more in the docs here: Add Seeds to your DAG | dbt Developer Hub

I’m not too sure why the files would be deleting afterwards.