microsoft/dbt-synapse

empty strings in seeds should be inserted as NULLs

dataders opened this issue · 2 comments

this seems to be assumed behavior in dbt-utils and has come up in dbt-msft/tsql-utils#17
dbt-sqlserver uses the ? but we're using row[column] which I don't understand the difference at all. I must have copied it from somewhere...
the real challenge comes from Synapse not supporting SQL Server's Table Value Constructor. so we need quoted lists?? do dates need to be quoted still???

more context from a Stack Overflow question I asked:

An empty string, on the other hand, evaluates to 0, which in SQL Server is implicitly an integer representing the number of days since 1900-01-01.

potential solution

add an elif condition after line 27 that if the agate column type Text or Date, and the data is an empty string, then replace with NULL.

https://github.com/dbt-msft/dbt-synapse/blob/2764b15c513b54d3054a1e1daa4049d6288d9ac5/dbt/include/sqlserver/macros/materializations/seed/seed.sql#L17-L34

fixed in 1.2.0