From 85a329a0534294224d1ee9de64772a8c8a65fc99 Mon Sep 17 00:00:00 2001 From: YaphetKG <45075777+YaphetKG@users.noreply.github.com> Date: Thu, 24 Dec 2020 09:03:26 -0500 Subject: [PATCH 1/3] Update entity_file.py catches exceptions when inferring arrays back falls to treating them as strings --- redisgraph_bulk_loader/entity_file.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redisgraph_bulk_loader/entity_file.py b/redisgraph_bulk_loader/entity_file.py index be00b0f..2a909d2 100644 --- a/redisgraph_bulk_loader/entity_file.py +++ b/redisgraph_bulk_loader/entity_file.py @@ -146,7 +146,10 @@ def inferred_prop_to_binary(prop_val): # If the property string is bracket-interpolated, it is an array. if prop_val[0] == '[' and prop_val[-1] == ']': - return array_prop_to_binary(format_str, prop_val) + try: + return array_prop_to_binary(format_str, prop_val) + except: + pass # If we've reached this point, the property is a string. encoded_str = str.encode(prop_val) # struct.pack requires bytes objects as arguments From 7db461c53c4380ba594eb2bc687246ea67d7da3c Mon Sep 17 00:00:00 2001 From: YaphetKG <45075777+YaphetKG@users.noreply.github.com> Date: Thu, 24 Dec 2020 09:26:05 -0500 Subject: [PATCH 2/3] Update entity_file.py Treats ID types as strings --- redisgraph_bulk_loader/entity_file.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redisgraph_bulk_loader/entity_file.py b/redisgraph_bulk_loader/entity_file.py index 2a909d2..1d89c1f 100644 --- a/redisgraph_bulk_loader/entity_file.py +++ b/redisgraph_bulk_loader/entity_file.py @@ -66,7 +66,7 @@ def typed_prop_to_binary(prop_val, prop_type): prop_val = prop_val.strip() # TODO allow ID type specification - if prop_type == Type.ID or prop_type == Type.LONG: + if prop_type == Type.LONG: try: numeric_prop = int(prop_val) return struct.pack(format_str + "q", Type.LONG.value, numeric_prop) @@ -75,7 +75,7 @@ def typed_prop_to_binary(prop_val, prop_type): if prop_type == Type.LONG: raise SchemaError("Could not parse '%s' as a long" % prop_val) - elif prop_type == Type.ID or prop_type == Type.DOUBLE: + elif prop_type == Type.DOUBLE: try: numeric_prop = float(prop_val) if not math.isnan(numeric_prop) and not math.isinf(numeric_prop): # Don't accept non-finite values. @@ -94,7 +94,7 @@ def typed_prop_to_binary(prop_val, prop_type): else: raise SchemaError("Could not parse '%s' as a boolean" % prop_val) - elif prop_type == Type.STRING: + elif prop_type== Type.ID or prop_type == Type.STRING: # If we've reached this point, the property is a string encoded_str = str.encode(prop_val) # struct.pack requires bytes objects as arguments # Encoding len+1 adds a null terminator to the string From 25493a4414a25e67d8faa735e3fcaca779bddc9d Mon Sep 17 00:00:00 2001 From: YaphetKG <45075777+YaphetKG@users.noreply.github.com> Date: Tue, 5 Jan 2021 11:41:02 -0500 Subject: [PATCH 3/3] Update relation_type.py handles "ERROR - 'RelationType' object has no attribute 'start_namespace' ", when using enforce schema with out namespaces. --- redisgraph_bulk_loader/relation_type.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/redisgraph_bulk_loader/relation_type.py b/redisgraph_bulk_loader/relation_type.py index ab6ab2a..5c84e36 100644 --- a/redisgraph_bulk_loader/relation_type.py +++ b/redisgraph_bulk_loader/relation_type.py @@ -10,6 +10,8 @@ class RelationType(EntityFile): def __init__(self, query_buffer, infile, type_str, config): super(RelationType, self).__init__(infile, type_str, config) self.query_buffer = query_buffer + self.start_namespace = None + self.end_namespace = None def process_schemaless_header(self, header): if self.column_count < 2: