Skip to content
Open
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
2 changes: 2 additions & 0 deletions falkordb/falkordb.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def from_url(cls, url: str, **kwargs) -> "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")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Suggest additional tests and documentation updates.

While the change correctly adds Unix socket support to the from_url method, consider the following suggestions to ensure comprehensive implementation:

  1. Add unit tests specifically for Unix socket connections using the from_url method.
  2. Update the class and method docstrings to mention Unix socket support.
  3. Consider adding an example of using a Unix socket connection in the class docstring.

Here's a suggested update for the class docstring:

class FalkorDB:
    """
    FalkorDB Class for interacting with a FalkorDB server.

    Supports both TCP and Unix socket connections.

    Usage examples::
        from falkordb import FalkorDB
        # Connect to the database using TCP and select the 'social' graph
        db = FalkorDB()
        graph = db.select_graph("social")

        # Connect using a Unix socket
        db_unix = FalkorDB.from_url("unix:///path/to/redis.sock")
        graph_unix = db_unix.select_graph("social")

        # Get a single 'Person' node from the graph and print its name
        result = graph.query("MATCH (n:Person) RETURN n LIMIT 1").result_set
        person = result[0][0]
        print(person.properties['name'])
    """

Also, consider adding a unit test for Unix socket connections:

def test_from_url_unix_socket():
    url = "unix:///path/to/redis.sock"
    db = FalkorDB.from_url(url)
    assert db.connection.connection_pool.connection_kwargs['unix_socket_path'] == "/path/to/redis.sock"
    assert db.connection.connection_pool.connection_kwargs['host'] is None
    assert db.connection.connection_pool.connection_kwargs['port'] is None

Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding test coverage for unix socket connections. The existing tests in tests/test_db.py::test_connect_via_url only cover TCP connections (falkor:// scheme). Adding a test case for unix:// URLs would help ensure this feature works correctly and prevent regressions.

Copilot uses AI. Check for mistakes.

Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing whitespace from this line.

Suggested change

Copilot uses AI. Check for mistakes.
if connection_class is redis.SSLConnection:
kwargs["ssl"] = True

Expand Down
Loading