sqlalchemy-solr
Apache Solr Dialect for SQLAlchemy
What it is and what it does
sqlalchemy-solr is a SQLAlchemy dialect that bridges Solr search indexes to Python applications by translating SQL queries into Solr's native query syntax. It lets you treat Solr collections as database tables, enabling both raw SQL execution and SQLAlchemy ORM-style queries. The dialect handles field mapping, multi-valued fields as SQL arrays, date range filtering, and Solr aliases as virtual tables.
The package depends on sqlalchemy, python-dateutil, requests, and sqlparse to manage connection pooling, date arithmetic, HTTP communication with Solr, and SQL parsing. It supports basic and JWT authentication, optional SSL/TLS, and integrates with tools like Apache Superset. Compatibility varies by Solr version: aliases work from 6.6 onward, SQL compilation caching and built-in date range compilation are available only in Solr 9.x.
Use it for:
- Connect Apache Superset to a Solr datasource for visual analytics and dashboarding without writing Solr query syntax.
- Build Python applications that query Solr collections using familiar SQLAlchemy ORM patterns instead of Solr's native query language.
- Run ad-hoc SQL SELECT queries against Solr indexes for reporting or data exploration.
- Migrate existing SQL-based applications to use Solr as a search backend with minimal code changes.
- Query Solr aliases that span multiple collections as if they were a single table with merged fields.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a SQLAlchemy dialect that allows you to query Apache Solr collections using standard SQL syntax and SQLAlchemy ORM patterns.
Yes, if you need to query Solr from Python using SQL or SQLAlchemy ORM and your Solr version is 6.0 or higher. The low install friction, permissive MIT license, and zero known vulnerabilities make it safe to adopt. However, the aging maintenance status (no recent commits, last release August 2024) means you should verify compatibility with your specific Solr and SQLAlchemy versions before committing to production use.
Install
sqlalchemy-solr on PyPI
pip
pip install sqlalchemy-solruv
uv add sqlalchemy-solrpoetry
poetry add sqlalchemy-solrInstalling sqlalchemy-solr
Before you install
Low install friction with a pure-Python wheel. Maintenance status is aging—last release was 2024-08-08 and the repository shows no recent commits, though it remains active and unarchived.
License in practice
MIT License permits commercial and private use with minimal restrictions, requiring only license and copyright notice retention.
Quickstart
pip install sqlalchemy-solr
from sqlalchemy import create_engine, text
engine = create_engine('solr://solr:8983/solr/examples_books')
with engine.connect() as connection:
result = connection.execute(text("SELECT sequence_i, genre_s FROM examples_books"))
for row in result:
print(row)
Requires Apache Solr 6.0 or higher; Solr instance must be running and accessible at the connection URL.
Verify before relying
- Whether the aging maintenance status (736 days since release) affects compatibility with recent Solr or SQLAlchemy versions.
- Real-world performance characteristics when querying large Solr collections.
- Completeness of SQL feature support beyond the documented compatibility table.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — sqlalchemy, python-dateutil, requests, sqlparse |
| Maintenance | aging — 736 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 86,589/month — #13,848 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sqlalchemy_solr-0.2.4.3-py3-none-any.whl
Keywords: Apache Solr, Solr, SQLAlchemy, dialect, Apache Superset
Tags
More Front-Ends packages
SQLAlchemy is a Python SQL toolkit and Object…
permissive · top 100 on PyPI
psycopg2-binarypsycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
alembicAlembic generates and manages database schema…
permissive · top 1,000 on PyPI
weaviate-clientA Python client library for connecting to and…
permissive · top 1,000 on PyPI
databricks-sql-connectorA Python client library that connects to…
permissive · top 1,000 on PyPI
psycopgPsycopg 3 is a PostgreSQL database adapter for…
copyleft · top 1,000 on PyPI
pysolrpysolr is a lightweight Python client for…
permissive · top 15,000 on PyPI
sqlalchemy-drillSQLAlchemy dialect for Apache Drill that…
permissive · top 5,000 on PyPI
teradatasqlalchemyProvides a SQLAlchemy dialect that enables…
unclear · top 5,000 on PyPI
sqlalchemy-hanaProvides a SQLAlchemy dialect that enables you…
permissive · top 15,000 on PyPI
kylinpyPython client library and SQLAlchemy dialect…
permissive · top 5,000 on PyPI
sqlalchemy_exasolSQLAlchemy dialect that enables Python…
permissive · top 15,000 on PyPI
databricks-sqlalchemyProvides a SQLAlchemy 2.0 dialect that bridges…
permissive · top 1,000 on PyPI
pybigquerySQLAlchemy dialect for BigQuery that enables…
permissive · top 15,000 on PyPI
sqlalchemy-dremioProvides a SQLAlchemy dialect to query Dremio…
permissive · top 15,000 on PyPI
sqlalchemy-spannerProvides a SQLAlchemy dialect that enables…
permissive · top 5,000 on PyPI