-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
sqlite-utils transform
should set empty strings to null when converting text columns to integer/float
#488
Comments
Frustratingly I think this counts as a backwards-incompatible change. Could have it be opt-in with a new option / method parameter, and then change it to the default if I release a |
No, I'm going to say that this is a bug - it's WEIRD having a So no need for a new option here - just fixing the bug is sensible. |
New tests should go in: https://github.com/simonw/sqlite-utils/blob/main/tests/test_transform.py I think the implementation fix needs to go near here: sqlite-utils/sqlite_utils/db.py Lines 1770 to 1775 in 0b315d3
The trick is going to be teaching that generated SQL to know which columns are |
It looks like SQLite has a We need to only apply that function to columns that we know to be of type integer or float though - text columns containing empty strings should not be rewritten to null. |
I would actually appreciate an option to do just that for text columns as well. |
It would be neat if this resulted in the following instead:
Related Discord discussion: https://discord.com/channels/823971286308356157/823971286941302908/1019635490833567794
The text was updated successfully, but these errors were encountered: