ClickHouse / ClickHouse/clickhouse-connect

Async SQLAlchemy support

Open
#576 9 comments 7 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
521
Forks
159
Avg merge
1d 7h
Merged PRs (30d)
46

Description

**Is your feature request related to a problem? Please describe.**
Currently, clickhouse-connect does not support using SQLAlchemy with async operations. Users must choose between get_async_client() for async capabilities or SQLAlchemy for query building, but cannot use both together. This is problematic for analytics applications that need SQLAlchemy's dynamic query construction (especially for filter-based queries) while maintaining async performance benefits.

**Describe the solution you'd like**
I would like clickhouse-connect to provide async SQLAlchemy support by implementing an async dialect that works with SQLAlchemy's create_async_engine().

Ideally, this would work similar to how other async database drivers operate:
```
engine = create_async_engine('clickhousedb+async://user:password@host:port/database')
```

**Describe alternatives you've considered**
The only alternative for asynchronous requests I could find is [clickhouse-sqlalchemy](https://clickhouse-sqlalchemy.readthedocs.io/en/latest/connection.html#asynch) which is unfortunately no longer maintained. Under the hood, another outdated library [asynch](https://pypi.org/project/asynch/) is used.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing SQLAlchemy integration and the get_async_client() entry point, then compare the requested create_async_engine() flow with the linked clickhouse-sqlalchemy async documentation. Done means clickhouse-connect exposes an async dialect that supports the proposed clickhousedb+async URL and async SQLAlchemy operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlalchemy
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.