FalkorDB / falkordb-bulk-loader

A Python utility for building FalkorDB databases from CSV inputs
https://www.falkordb.com/
MIT License
3 stars 0 forks source link

Falkordb Bulk Insert does not support --unix-socket-path option. #11

Open sachinjogi opened 1 week ago

sachinjogi commented 1 week ago

I'm trying to port my app from redisgraph to falkordb.

My redis instance listens on unix socket instead of tcp. I want to know how I can use falkordb-bulk-insert if my redis is listening on Unix socket.

I'm currently using redisgraph-bulk-insert v0.10.2. Noting that --unix-socket-path was deprecated in redisgraph-bulk-loader v0.12.0.

Since falkordb-bulk-insert uses server_url, which internally uses the from_url in redis python, I tried using falkordb-bulk-insert --server-url "unix:///sockets/redis0.sock", but I run into the below error.

redis.exceptions.ConnectionError: Error 97 connecting to localhost:6379. Address family not supported by protocol.

I did try to connect to the redis directly using redis-python using the above unix socket url and appears to be working.

In [3]: redis.from_url("unix:///sockets/redis0.sock").ping()
Out[3]: True

Any idea what might be wrong?

This is same requirement as https://github.com/RedisGraph/redisgraph-bulk-loader/issues/109.

sachinjogi commented 6 days ago

I think, this change would be good enough.

bash-4.4# git diff
diff --git a/falkordb/falkordb.py b/falkordb/falkordb.py
index 9d3df80..7f468e7 100644
--- a/falkordb/falkordb.py
+++ b/falkordb/falkordb.py
@@ -141,6 +141,7 @@ class FalkorDB():
         kwargs['port'] = connection_kwargs.get('port', 6379)
         kwargs['username'] = connection_kwargs.get('username')
         kwargs['password'] = connection_kwargs.get('password')
+        kwargs['unix_socket_path'] = connection_kwargs.get('path')

         # Initialize a FalkorDB instance using the updated kwargs
         db = cls(**kwargs)