All Projects → cloudflare → Sqlalchemy Clickhouse

cloudflare / Sqlalchemy Clickhouse

Licence: apache-2.0

Programming Languages

python
139335 projects - #7 most used programming language

sqlalchemy-clickhouse

ClickHouse dialect for SQLAlchemy.

Installation

The package is installable through PIP::

pip install sqlalchemy-clickhouse

Usage

The DSN format is similar to that of regular Postgres::

>>> import sqlalchemy as sa
>>> sa.create_engine('clickhouse://username:[email protected]:port/database')
Engine('clickhouse://username:[email protected]:port/database')

For SSL add ssl parameter to URL::

>>> import sqlalchemy as sa
>>> sa.create_engine('clickhouse://username:[email protected]:port/database?ssl=True')
Engine('clickhouse://username:[email protected]:port/database')

It implements a dialect, so there's no user-facing API.

Testing

The dialect can be registered on runtime if you don't want to install it as::

from sqlalchemy.dialects import registry
registry.register("clickhouse", "base", "dialect")
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].