Skip to content

Commit 93323fa

Browse files
committed
Add support for SSL-wrapped connections
1 parent e4f3aac commit 93323fa

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ bulk_insert.py GRAPHNAME [OPTIONS]
1717
|---------|-----------------------|----------------------------------------------|
1818
| -h | --host TEXT | Redis server host (default: 127.0.0.1) |
1919
| -p | --port INTEGER | Redis server port (default: 6379) |
20-
| -P | --password TEXT | Redis server password |
21-
| -s | --ssl TEXT | Server is SSL-enabled |
20+
| -a | --password TEXT | Redis server password |
21+
| -c | --ssl_certfile TEXT | path to certfile for SSL connection |
22+
| -k | --ssl_keyfile TEXT | path to keyfile for SSL connection |
2223
| -n | --nodes TEXT | path to node csv file [required] |
2324
| -r | --relationships TEXT | path to relationship csv file |
2425

@@ -41,6 +42,7 @@ The label (for nodes) or relationship type (for relationships) is derived from t
4142
### Relationship files
4243
- Relationship inputs have no headers.
4344
- Each row should specify a source and destination node ID.
45+
- All specified node IDs must exist in the database, as described in [Determining Node IDs](#determining-node-ids).
4446
- Described relationships are always considered to be directed (source->destination).
4547
- The bulk insert script does not yet support adding properties to relationships (though this can be done after the fact with RedisGraph queries).
4648
- _NOTE_ Relationship processing does not yet include node lookups. The entries in a relationship file should all be integers corresponding to node IDs.

bulk_insert.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,20 +237,24 @@ def help():
237237
# Redis server connection settings
238238
@click.option('--host', '-h', default='127.0.0.1', help='Redis server host')
239239
@click.option('--port', '-p', default=6379, help='Redis server port')
240-
@click.option('--password', '-P', default=None, help='Redis server password')
241-
@click.option('--ssl', '-s', default=False, help='Server is SSL-enabled')
240+
@click.option('--password', '-a', default=None, help='Redis server password')
241+
@click.option('--ssl_certfile', '-c', default=None, help='Path to SSL certfile')
242+
@click.option('--ssl_keyfile', '-k', default=None, help='Path to SSL keyfile')
242243
# CSV file paths
243244
@click.option('--nodes', '-n', required=True, multiple=True, help='path to node csv file')
244245
@click.option('--relationships', '-r', multiple=True, help='path to relation csv file')
245246
# Debug options
246247
@click.option('--max_buffer_size', '-m', default=1024*1024, help='(DEBUG ONLY) - max token count per Redis query')
247248

248-
def bulk_insert(graph, host, port, password, ssl, nodes, relationships, max_buffer_size):
249+
def bulk_insert(graph, host, port, password, ssl_certfile, ssl_keyfile, nodes, relationships, max_buffer_size):
249250
global graphname
250251
global redis_client
251252
global max_tokens
252253
graphname = graph
253-
redis_client = redis.StrictRedis(host=host, port=port, password=password, ssl=ssl)
254+
ssl = False
255+
if ssl_certfile or ssl_keyfile:
256+
ssl = True
257+
redis_client = redis.StrictRedis(host=host, port=port, password=password, ssl=ssl, ssl_certfile=ssl_certfile, ssl_keyfile=ssl_keyfile)
254258
if max_buffer_size > max_tokens:
255259
print("Requested buffer size too large, capping queries at %d." % max_tokens)
256260
else:

0 commit comments

Comments
 (0)