csv_to_snapshot: Treat empty csv field as null

Reviewers: florijan, mislav.bradac, buda

Reviewed By: florijan

Differential Revision: https://phabricator.memgraph.io/D736
This commit is contained in:
Teon Banek 2017-09-01 14:25:12 +02:00
parent 0a5e9256f1
commit 7294f7812e

View File

@ -27,6 +27,9 @@ _CSV_TYPE_TO_PY_TYPE = {
def csv_to_py_val(value, csv_type, array_delimiter):
if not value.strip():
# Empty string signifies null or None in Python.
return None
if not csv_type.endswith('[]'):
return _CSV_TYPE_TO_PY_TYPE[csv_type](value)
# Otherwise we have an array type, so convert it to a list.