FalkorDriver class provides connectivity to FalkorDB, a Redis-based graph database with RedisSearch integration.
Overview
FalkorDB is a multi-tenant graph database built on Redis. The FalkorDriver provides:- Redis-based graph storage
- RedisSearch fulltext indexing
- Multi-tenant database support
- Connection to FalkorDB Cloud or on-premises
- Automatic datetime conversion
Constructor
Parameters
str
default:"localhost"
The hostname where FalkorDB is running.For on-premises deployments, this is typically
"localhost".
For FalkorDB Cloud, use the provided cloud endpoint.Example: "localhost" or "cloud.falkordb.com"int
default:"6379"
The port on which FalkorDB is listening.The default Redis port is 6379. FalkorDB Cloud may use different ports.Example:
6379str | None
default:"None"
The username for authentication.Optional for on-premises deployments. Required for FalkorDB Cloud.Example:
"admin"str | None
default:"None"
The password for authentication.Optional for on-premises deployments. Required for FalkorDB Cloud.Example:
"your-password"FalkorDB | None
default:"None"
An existing FalkorDB client instance to reuse.If provided, the driver will use this client instead of creating a new one.
Useful for sharing connections or custom client configurations.Example:
FalkorDB(host="localhost", port=6379)str
default:"default_db"
The name of the database (graph) to connect to.FalkorDB supports multiple graphs. Each graph is isolated.Example:
"graphiti" or "user_graph"Methods
execute_query
Execute a Cypher query and return results.cypher_query_(str) - The Cypher query to execute**kwargs- Query parameters (automatically converted for FalkorDB)
tuple[list[dict], list[str], None] - Records, headers, and summary
FalkorDB does not support native datetime objects. The driver automatically converts datetime values to ISO format strings.
session
Create a new database session.database(str | None) - Optional database name override
FalkorDriverSession - Session object
close
Close the driver and release connections.None
build_indices_and_constraints
Create all required indices for Graphiti.delete_existing(bool) - If True, delete existing indices before creating new ones
None
This method is automatically called during driver initialization.
health_check
Verify connectivity to FalkorDB.None - Raises exception if connection fails
clone
Create a copy of the driver targeting a different database.database(str) - The name of the database to target
GraphDriver - New driver instance
build_fulltext_query
Build a RedisSearch-compatible fulltext query string.query(str) - The search query textgroup_ids(list[str] | None) - Optional list of group IDs to filter bymax_query_length(int) - Maximum query length (default: 128)
str - RedisSearch formatted query
FalkorDB uses RedisSearch syntax with the
@ prefix for field queries. The driver automatically formats queries and escapes reserved characters.sanitize
Sanitize query text by replacing FalkorDB special characters with whitespace.query(str) - The text to sanitize
str - Sanitized text with special characters replaced
Properties
provider
GraphProvider.FALKORDB enum value.
fulltext_syntax
default_group_id
Operations Properties
The driver exposes specialized operation interfaces:Usage Examples
Basic Connection (On-Premises)
FalkorDB Cloud Connection
With Graphiti
Multi-Tenant Usage
Fulltext Search with RedisSearch
Reusing an Existing FalkorDB Client
Environment Variables
Common environment variables for FalkorDB configuration:Installation
FalkorDB support requires the optionalfalkordb extra:
Datetime Handling
FalkorDB does not support native datetime objects. The driver automatically converts:- Query parameters
- List values
- Nested dictionary values
Stopwords
FalkorDB’s RedisSearch automatically filters common stopwords. The driver includes a comprehensive stopword list that mirrors RedisSearch behavior:Related
Drivers Overview
Learn about the driver architecture
Graphiti
Main Graphiti class documentation
Neo4j Driver
Alternative production-ready driver
Kuzu Driver
Embedded analytics driver