Install & Compatibility
Where this runs
tested against v0.2.4.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.560s · 42.1MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.4s · import 0.516s · 38MB
39MB installed
● package 39MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
create_engine
✓ from sqlalchemy import create_engine
✗ from sqlalchemy_solr import create_engine
create_engine is from SQLAlchemy, not sqlalchemy-solr. The dialect is registered via URL prefix.
savoir
✓ from sqlalchemy_solr import savoir
Utility to check Solr version compatibility.
Connect to a Solr core and run a basic SQL query.
from sqlalchemy import create_engine, text
import os
# Solr URL, default 'http://localhost:8983/solr'
solr_url = os.environ.get('SOLR_URL', 'http://localhost:8983/solr')
# Create engine with solr:// prefix, database name is Solr core/collection
engine = create_engine(f'solr://admin:@localhost:8983/solr/collection1')
with engine.connect() as conn:
result = conn.execute(text("SELECT * FROM collection1 LIMIT 10"))
for row in result:
print(row)
Errors
Common errors & fixes
sqlalchemy.exc.ArgumentError: Could not determine version of SQLAlchemy
Missing or incompatible SQLAlchemy version (e.g., 2.x).
fixInstall SQLAlchemy 1.4.x: pip install 'sqlalchemy>=1.4,<2.0'
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8983): Max retries exceeded
Solr server not running or port incorrect.
fixStart Solr or check host/port in connection string.
ImportError: cannot import name 'savoir' from 'sqlalchemy_solr'
Older version of sqlalchemy-solr without savoir module.
fixUpgrade to >=0.2.4.0: pip install --upgrade sqlalchemy-solr
solr.exceptions.SolrException: Error from Solr: org.apache.solr.common.SolrException: Collection not found: mycore
Specified Solr core/collection does not exist.
fixUse existing core name as database in URL.
Upgrade
Version history
0.2.4.3latest on PyPI · released Aug 8, 2024
Audit
Dependencies
sqlalchemy>=1.4,<2.0requiredRequired - integrates with SQLAlchemy Core/ORM
requests>=2.25.1,<3.0requiredRequired - HTTP client for Solr
lxml>=4.0,<6.0requiredRequired - XML parsing for Solr responses