Install and connect
Install the Redis ADBC driver and check your connection to Redis.
The Redis ADBC driver ships as the adbc-driver-redis Python package. The
package bundles the native driver, so you don't need to build anything. Other
tools that load ADBC drivers by name, such as DuckDB, can use the same library
after you register it.
Before you start
You need:
- Python 3.12 or later, on Linux (x86-64 or ARM64, glibc 2.28 or later) or macOS on Apple silicon (macOS 15 or later). There are no wheels for other platforms.
- A Redis database with the Query Engine (Search) enabled. See the requirements for supported deployments.
Install the package
-
Create and activate a virtual environment:
python3 -m venv .venv . .venv/bin/activate -
Install the driver with its DB-API extra. DB-API is Python's standard database interface, and the extra adds the
dbapimodule and its dependencies:python -m pip install 'adbc-driver-redis[dbapi]' -
Check the installation without connecting to Redis:
python -m adbc_driver_redis doctor --offlineThe
doctorcommand printsOK,SKIP, orFAILfor each check. It exits with 0 when the checks pass, 1 when a check fails, and 2 when its arguments are invalid.
Installing the package doesn't start a Redis server.
Connect to Redis
The driver connects with a Redis URI. Set it in your environment rather than in code, so that credentials stay out of your source files and shell history.
| Connection | URI |
|---|---|
| No TLS | redis://<host>:<port>/0 |
| TLS with certificate verification | rediss://<host>:<port>/0 |
| With credentials | redis://<username>:<password>@<host>:<port>/0 |
If a username or password contains reserved characters then you must URL-encode them. Use your deployment's actual host and port rather than assuming 6379. Only database 0 is supported on a cluster, and the project has tested only database 0 on standalone servers.
-
Set the URI:
export REDIS_URI='redis://<host>:<port>/0' -
Check the connection:
python -m adbc_driver_redis doctorThe connection check opens a normal driver connection, confirms that Search is available, and runs
SELECT 1. It doesn't create tables or write data. If it printsFAIL, check the URI, network access, the server requirements, and the user's ACL permissions.
A plaintext connection check doesn't test TLS. To test TLS, run doctor with
your rediss:// URI. If your server uses a certificate from a private
certificate authority, pass its PEM bundle with --ca-file:
python -m adbc_driver_redis doctor --ca-file <path-to-ca.pem>
If the database uses ACLs, then the user needs a specific set of commands and key patterns. See ACL users in the driver reference.
Use the driver from other tools
Tools that load ADBC drivers by name, such as DuckDB, need a driver manifest that points to the library in the Python package.
-
Register the driver for your user:
python -m adbc_driver_redis install-manifest --userUse
--venvto register it for the active virtual environment only, or--directory <manifest-directory>for a custom location. If you use a custom directory, add it to theADBC_DRIVER_PATHenvironment variable of the tool that loads the driver. -
Check that both the
redisandredissdriver names work against your server:python -m adbc_driver_redis doctor --check-manifests
The manifests contain absolute paths into the installed package. Keep the virtual environment in place, and run the registration command again if you move or replace it.
If you don't use Python, the project provides a native installer that downloads, verifies, and registers a release of the library. See Install, upgrade and uninstall the native driver.
Run a query from code
This example connects to Redis and runs SELECT 1. The Python version uses the
package's DB-API module. The Go version loads the registered driver by name
with the ADBC driver manager, so
register the driver first. It needs
Go 1.25 or later with cgo enabled, and a C compiler.
Create a file named select_one.py:
import os
from adbc_driver_redis import dbapi
with dbapi.connect(os.environ["REDIS_URI"]) as conn:
with conn.cursor() as cur:
cur.execute("SELECT 1 AS one")
print(cur.fetch_arrow_table())
Run it:
python select_one.py
pyarrow.Table
one: int32
----
one: [[1]]
The driver also works from other languages and from tools that load ADBC drivers. The project's integration guides cover them.