-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
enhancementFeature requests.Feature requests.
Description
@karim came up with a good default behaviour for the CSV import in #1349:
I just want to say something. 😃
Regarding the expected behavior of DB4S when importing empty values from a CSV.
- If the column has a default value then it gets priority over everything else.
- This is the default action for SQLite, it fills columns with default values when a value is not given.
- The column being
NOT NULLor not doesn't matter, since a value will be set for it anyway.- ✔️ No need for a checkbox, it should be the right thing to do. 👍
- If the column does not have a default value.
- Check if the column does not have
NOT NULL, if true:
- Then just add
NULLto it, it should be the default.- Be consistent. CSV value is
NULL, SQLite table doesn't forbidNULL, so just addNULL.- ✔️ Also, no need for a checkbox, and this is what everyone here wants. 🎉
- Else if it does have
NOT NULL, then we have two options, either:
- Fail the import (make sense since you are importing
NULLto aNOT NULLcolumn), or- Set a default value for it (e.g.
0forINTEGER,""forTEXT)
- Probably by adding a checkbox to "set default values for empty fields in NOT NULL columns" (need a better wording 😄)
We should implement some rules in the import code to reflect this and maybe add some configuration options to make any deviation from this default an explicit decision by the user.
Metadata
Metadata
Assignees
Labels
enhancementFeature requests.Feature requests.