microsoft/dbt-synapse

dbt seed does not handle blanks as NULLS (for int fields) #2843

alittlesliceoftom opened this issue · 3 comments

Moving over from dbt-labs/dbt-core#2843.

This is a minor bug, but does make seeds much less useful. I have not tested on a different adapter but folks at core seemed confident it was an adapter problem.

Describe the bug
A clear and concise description of what the bug is. What command did you run? What happened?

Running dbt seed -s mycsv leads to this error:

('22018', "[22018] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Conversion failed when converting the varchar value 'None' to data type int. (245) (SQLExecDirectW)")

Steps To Reproduce
In as much detail as possible, please provide steps to reproduce the issue. Sample data that triggers the issue, example model code, etc is all very helpful here.

Below .csv fails with Errror
Id, col
1,1
2,NULL
3,3

Below .csv fails with Errror
Id, col
1,1
2,
3,3

Below .csv passes
Id, col
1,1
2,2
3,3

Expected behavior
A clear and concise description of what you expected to happen.

Blank columns that Python inteprets as Nones are interpreted as NULLS by DB

Screenshots and log output
If applicable, add screenshots or log output to help explain your problem.

System information
Which database are you using dbt with?
dbt-synapse adapter

The output of dbt --version:

installed version: 0.18.0
latest version: 0.18.1
The operating system you're using:
Windows
The output of python --version:
Python 3.8.6

Additional context
Add any other context about the problem here.

@alittlesliceoftom, thanks for reprex! I agree that this is something we can fix. @mikaelene have you seen this before? At first glance, I'd like to support the second csv example with missing values in the csv getting transcoded into NULL Synapse-side. However, I'm not too keen on support for first example as NULL is a SQL thing rather than a csv thing.

Agree on the first example NULL, I actually did that as a secondary check.

Closed by #24