Skip to content

Fix linter errors #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions redisgraph_bulk_loader/bulk_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def process_entities(entities):
entity.query_buffer.buffer_size += added_size


################################################################################
# Bulk loader
################################################################################
# Command-line arguments
@click.command()
@click.argument('graph')
Expand Down Expand Up @@ -124,27 +127,28 @@ def bulk_insert(graph, host, port, password, unix_socket_path, nodes, nodes_with
# Add in Graph Indices after graph creation
for i in index:
l, p = i.split(":")
print("Creating Index on Label: %s, Property: %s" %(l, p))
print("Creating Index on Label: %s, Property: %s" % (l, p))
try:
index_create = client.execute_command("GRAPH.QUERY", graph, "CREATE INDEX ON :%s(%s)" %(l, p))
index_create = client.execute_command("GRAPH.QUERY", graph, "CREATE INDEX ON :%s(%s)" % (l, p))
for z in index_create:
print(z[0].decode("utf-8") )
print(z[0].decode("utf-8"))
except redis.exceptions.ResponseError as e:
print("Unable to create Index on Label: %s, Property %s" %(l, p))
print("Unable to create Index on Label: %s, Property %s" % (l, p))
print(e)

# Add in Full Text Search Indices after graph creation
for i in full_text_index:
l, p = i.split(":")
print("Creating Full Text Search Index on Label: %s, Property: %s" %(l, p))
print("Creating Full Text Search Index on Label: %s, Property: %s" % (l, p))
try:
index_create = client.execute_command("GRAPH.QUERY", graph, "CALL db.idx.fulltext.createNodeIndex('%s', '%s')" %(l, p))
index_create = client.execute_command("GRAPH.QUERY", graph, "CALL db.idx.fulltext.createNodeIndex('%s', '%s')" % (l, p))
print(index_create[-1][0].decode("utf-8"))
except redis.exceptions.ResponseError as e:
print("Unable to create Full Text Search Index on Label: %s, Property %s" %(l, p))
print("Unable to create Full Text Search Index on Label: %s, Property %s" % (l, p))
print(e)
except:
print("Unknown Error: Unable to create Full Text Search Index on Label: %s, Property %s" %(l, p))
print("Unknown Error: Unable to create Full Text Search Index on Label: %s, Property %s" % (l, p))


if __name__ == '__main__':
bulk_insert()
2 changes: 1 addition & 1 deletion redisgraph_bulk_loader/entity_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.ID or 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
Expand Down