Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty strings in seeds should be inserted as NULLs #36

Closed
dataders opened this issue Jan 8, 2021 · 2 comments · Fixed by #136
Closed

empty strings in seeds should be inserted as NULLs #36

dataders opened this issue Jan 8, 2021 · 2 comments · Fixed by #136
Assignees
Labels

Comments

@dataders
Copy link
Contributor

dataders commented Jan 8, 2021

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

@dataders
Copy link
Contributor Author

@alieus here is more context on the difference b/w SQL Server and Synapse

https://github.com/dbt-msft/dbt-synapse/blob/master/synapse_syntax_wishlist.md#1-table-valued-constructor

@dataders dataders added bug Something isn't working Size: Medium TSQL Expertise labels Sep 1, 2022
@sdebruyn
Copy link
Collaborator

sdebruyn commented Oct 7, 2022

fixed in 1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants