From abe7bb42fb6c062906a7d42b7aaa3ceec2598e93 Mon Sep 17 00:00:00 2001 From: jvanmalder Date: Mon, 1 Mar 2021 13:23:54 +0100 Subject: [PATCH] strip before checking for empty value --- redisgraph_bulk_loader/entity_file.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/redisgraph_bulk_loader/entity_file.py b/redisgraph_bulk_loader/entity_file.py index 1f4f605..5044560 100644 --- a/redisgraph_bulk_loader/entity_file.py +++ b/redisgraph_bulk_loader/entity_file.py @@ -115,14 +115,15 @@ def typed_prop_to_binary(prop_val, prop_type): def inferred_prop_to_binary(prop_val): # All format strings start with an unsigned char to represent our prop_type enum format_str = "=B" + + # Remove leading and trailing whitespace + prop_val = prop_val.strip() + if prop_val == "": # An empty string indicates a NULL property. # TODO This is not allowed in Cypher, consider how to handle it here rather than in-module. return struct.pack(format_str, 0) - # Remove leading and trailing whitespace - prop_val = prop_val.strip() - # Try to parse value as an integer. try: numeric_prop = int(prop_val)