alchemiq
The data layer for async FastAPI microservices: Django-style models, transactional outbox, caching, and ClickHouse - built on SQLAlchemy 2.0.
30-second example
import alchemiq
from alchemiq import Model, Repository
from alchemiq.types import PK, Email
class User(Model):
id: PK[int]
name: str
email: Email
alchemiq.configure("postgresql+asyncpg://user:password@localhost/mydb")
await alchemiq.create_all()
users = Repository(User)
user = await users.create(name="Ada Lovelace", email="ada@example.com")
found = await users.get(id=user.id)
print(found.name) # Ada Lovelace
Features
- Async PostgreSQL and ClickHouse - a single query DSL covers both backends.
- Django-flavoured models - declare fields with plain type annotations;
Qobjects,QuerySetchaining,order_by,limit, andoffsetwork exactly as you would expect. - Repository + UnitOfWork - full CRUD, bulk operations, cursor/keyset pagination, and
aggregations (
Count,Sum,Avg,Min,Max) out of the box. - Soft-delete and optimistic locking - opt in per model via a
Metaclass. - Signals - async pre/post hooks for create, update, and delete lifecycle events.
- Serialization -
to_dict,to_schema,to_pydanticwith field inclusion/exclusion. - Outbox + Relay - atomic event capture in the same transaction, published to any broker (RabbitMQ, Kafka, NATS) via TaskIQ or FastStream.
- FastAPI integration - auto-generated CRUD router, DI-ready repository and UoW providers,
Pydantic schema generation, and a
/health/ready·/health/liverouter. - FastStream consumer DI - inject sessions, UoW, and repositories into message handlers.
- Redis caching - per-repository cache with automatic invalidation on write.
- Migrations - Alembic wrapper for PostgreSQL; a custom engine for ClickHouse.
- Scaffolding -
alchemiq initgenerates a production-ready layered project skeleton. - SQLite dev/test tier - run your app's tests without Docker; PostgreSQL stays the production target.
Installation
pip install "alchemiq[all]"
| Extra | Installs |
|---|---|
email |
email-validator |
phone |
phonenumbers |
argon2 |
argon2-cffi |
bcrypt |
bcrypt (not in all) |
crypto |
cryptography |
outbox |
taskiq, taskiq-aio-pika |
fastapi |
fastapi |
faststream |
faststream |
redis |
redis |
postgres |
asyncpg (the PostgreSQL driver) |
sqlite |
aiosqlite (the SQLite driver, dev/test tier) |
clickhouse |
clickhouse-connect[async], clickhouse-sqlalchemy |
migrations |
alembic |
all |
all of the above except bcrypt |
Documentation
Full guide and API reference: https://alchemiq.readthedocs.io
Links
- Source: https://github.com/TrifoN-off/alchemiq
- Changelog: CHANGELOG.md
- License: MIT - see LICENSE
What's not in v1
alchemiq v1 does not include a visual admin, MySQL support, synchronous mode,
multi-database routing, audit logs, geolocation fields, or file-field storage adapters.
SQLite is supported as a dev/test tier - see the SQLite guide.
See the What's not in v1 guide for the full list and the reasoning behind each deferral.
Metadata
Release files for alchemiq 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| alchemiq-0.2.2.tar.gz | 452.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| alchemiq-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 640.3 kB
Release files / alchemiq-0.2.2.tar.gz
| Download URL | alchemiq-0.2.2.tar.gz |
|---|---|
| Size | 452.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e194bfa53915ecfae92034db6e4ce8c1048ea3a921b26dfcb680f2e56631d3c
|
|
BLAKE2b-256 checksum How to use checksums |
3d8a8c310eadd707249a81a9cc8dadd0d4aa8bfb98ef4cd488f0c9e18222dd71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency logRelease files / alchemiq-0.2.2-py3-none-any.whl
| Download URL | alchemiq-0.2.2-py3-none-any.whl |
|---|---|
| Size | 187.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5cbce6158b0fe776e53a671affee3a94ead9b39d068cf62dc55e8d3276c9313a
|
|
BLAKE2b-256 checksum How to use checksums |
b6d40aac4a1236fce61be8fed695b29efd42657c2c48fd9074be44a0d61c3960
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency log