Get your features to production faster.

Try Redis Feature Form

Blog

Use Redis with SQL

May 06, 20261 minute read
Tyler Hutcherson
Tyler Hutcherson
Robert Shelton
Robert Shelton

Yes, you heard that right. Query Redis with SQL. No LLMs needed.

Most data science teams already speak SQL fluently, and for many (including LLMs and agents), it’s still the most intuitive way to express queries. At the same time, teams often need the speed and flexibility of Redis at scale.

Luckily the Redis API already provides nearly all the primitives required to express rich, SQL-like queries against a single index, but translating between the two can be cumbersome.

To help close this gap, we released the sql-redis library to PyPi and added the SQLQuery class to redisvl so you can run SQL-like queries at Redis speed.

Quick start with RedisVL

Install:

Setup index:

Query:

Output:

Under the hood

The SQLQuery class converts a sql-like statement such as:

into an equivalent Redis query.

Conveniently, you can preview the Redis query to be executed via the .redis_query_string() available on the SQLQuery class:

The SQLQuery class accomplishes this deterministically, without an LLM, with the help of sqlglot and the parser within sql-redis. Check out the source code for more details.

More than simple selects

The core translation engine already handles aggregations, full-text search, geo queries, and async execution.

Conditional operators

Natural language intent

SQL

Redis

Vector search

Natural language intent

SQL

Redis

Aggregations

Natural language intent

SQL

Redis

Check out the redisvl user guide for a full demo of queries available.

To wrap things up

  • You can now query Redis indexes with familiar SQL syntax
  • Under the hood, sql-redis parses your SQL into an AST (Abstract Syntax Tree), checks it against your index schema, and emits the right FT.SEARCH or FT.AGGREGATE command.
  • Beyond basic filters, it already supports aggregations, full-text search, geo queries, date functions, parameterized queries, and async execution.
  • It runs fast. Schema metadata is cached so translation overhead stays in the low milliseconds.

Try it out now

Get started with Redis today

Speak to a Redis expert and learn more about enterprise-grade Redis today.