Skip to content

Add command-line argument to set ACL user #58

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
May 4, 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
7 changes: 4 additions & 3 deletions redisgraph_bulk_loader/bulk_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def process_entities(entities):
@click.option('--host', '-h', default='127.0.0.1', help='Redis server host')
@click.option('--port', '-p', default=6379, help='Redis server port')
@click.option('--password', '-a', default=None, help='Redis server password')
@click.option('--user', '-w', default=None, help='Username for Redis ACL')
@click.option('--unix-socket-path', '-u', default=None, help='Redis server unix socket path')
# CSV file paths
@click.option('--nodes', '-n', multiple=True, help='Path to node csv file')
Expand All @@ -69,7 +70,7 @@ def process_entities(entities):
@click.option('--max-token-size', '-t', default=500, help='max size of each token in megabytes (default 500, max 512)')
@click.option('--index', '-i', multiple=True, help='Label:Propery on which to create an index')
@click.option('--full-text-index', '-f', multiple=True, help='Label:Propery on which to create an full text search index')
def bulk_insert(graph, host, port, password, unix_socket_path, nodes, nodes_with_label, relations, relations_with_type, separator, enforce_schema, skip_invalid_nodes, skip_invalid_edges, escapechar, quote, max_token_count, max_buffer_size, max_token_size, index, full_text_index):
def bulk_insert(graph, host, port, password, user, unix_socket_path, nodes, nodes_with_label, relations, relations_with_type, separator, enforce_schema, skip_invalid_nodes, skip_invalid_edges, escapechar, quote, max_token_count, max_buffer_size, max_token_size, index, full_text_index):
if sys.version_info[0] < 3:
raise Exception("Python 3 is required for the RedisGraph bulk loader.")

Expand All @@ -87,9 +88,9 @@ def bulk_insert(graph, host, port, password, unix_socket_path, nodes, nodes_with
# Attempt to connect to Redis server
try:
if unix_socket_path is not None:
client = redis.StrictRedis(unix_socket_path=unix_socket_path, password=password)
client = redis.StrictRedis(unix_socket_path=unix_socket_path, username=user, password=password)
else:
client = redis.StrictRedis(host=host, port=port, password=password)
client = redis.StrictRedis(host=host, port=port, username=user, password=password)
except redis.exceptions.ConnectionError as e:
print("Could not connect to Redis server.")
raise e
Expand Down
7 changes: 4 additions & 3 deletions redisgraph_bulk_loader/bulk_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def process_update_csv(self):
@click.option('--host', '-h', default='127.0.0.1', help='Redis server host')
@click.option('--port', '-p', default=6379, help='Redis server port')
@click.option('--password', '-a', default=None, help='Redis server password')
@click.option('--user', '-w', default=None, help='Username for Redis ACL')
@click.option('--unix-socket-path', '-u', default=None, help='Redis server unix socket path')
# Cypher query options
@click.option('--query', '-q', help='Query to run on server')
Expand All @@ -117,7 +118,7 @@ def process_update_csv(self):
@click.option('--no-header', '-n', default=False, is_flag=True, help='If set, the CSV file has no header')
# Buffer size restrictions
@click.option('--max-token-size', '-t', default=500, help='Max size of each token in megabytes (default 500, max 512)')
def bulk_update(graph, host, port, password, unix_socket_path, query, variable_name, csv, separator, no_header, max_token_size):
def bulk_update(graph, host, port, password, user, unix_socket_path, query, variable_name, csv, separator, no_header, max_token_size):
if sys.version_info[0] < 3:
raise Exception("Python 3 is required for the RedisGraph bulk updater.")

Expand All @@ -126,9 +127,9 @@ def bulk_update(graph, host, port, password, unix_socket_path, query, variable_n
# Attempt to connect to Redis server
try:
if unix_socket_path is not None:
client = redis.StrictRedis(unix_socket_path=unix_socket_path, password=password, decode_responses=True)
client = redis.StrictRedis(unix_socket_path=unix_socket_path, username=user, password=password, decode_responses=True)
else:
client = redis.StrictRedis(host=host, port=port, password=password, decode_responses=True)
client = redis.StrictRedis(host=host, port=port, username=user, password=password, decode_responses=True)
except redis.exceptions.ConnectionError as e:
print("Could not connect to Redis server.")
raise e
Expand Down