TOML does not have a way to indicate a None
value in its syntax, meaning that setting inserting a "none" of ""
is shown as an empty string instead of null. This is an issue that has come up with attempting to insert people into the DB that don't have an email address. As there has already been an entry with ""
, it won't insert as the email field requires a unique value (or null).
Fields should be able to be ommitted from the TOML insertion if nullable or holo
should automatically change empty strings. There already exist (and are used) two functions that should be doing this: holo_data._get_nullable_values
& holo_data.get_type_matchup
, but the now intended functionality is not present.
It seems this:
type_match: dict[re.Pattern, tuple[str, type, pl.datatypes.DataTypeClass, Any]] = {
re.compile("BIGINT UNSIGNED"): ("number", int, pl.UInt64, 0),
re.compile("BIGINT"): ("number", int, pl.Int64, 0),
re.compile("INT UNSIGNED"): ("number", int, pl.UInt32, 0),
re.compile("INT"): ("number", int, pl.Int32, 0),
re.compile("CHAR|TEXT"): ('text (enclosed in "")', str, pl.Utf8, ""),
re.compile("BOOLEAN"): ("boolean (true/false)", bool, pl.Boolean, False),
re.compile("DATE|TIME"): (
"datetime (in ISO format)",
dt.datetime,
pl.Datetime,
dt.datetime(1970, 1, 1, 0, 0, 0),
),
}
should be changed so that the CHAR|TEXT
key reads:
re.compile("CHAR|TEXT"): ('text (enclosed in "")', str, pl.Utf8, "")
instead. This may achieve the desired result of setting empty strings to None
. OR somewhere along the way, ""
should be set to None
before being inserted into the database.
savoy referenced this ticket in commit a7779c8.