Skip to main content
Version: Next
ClickHouse is an open-source column-oriented database for real-time analytics using SQL. It's known for extremely fast query performance on large datasets.
Installation
Required packages: clickhouse-sqlalchemyclickhouse-connect>=1.8.0,<2.0
# For a Python environment
pip install "clickhouse-connect>=1.8.0,<2.0"

# For the repository Docker Compose setup
echo "clickhouse-connect>=1.8.0,<2.0" >> ./docker/requirements-local.txt
# Restart the containers after adding the driver.
Drivers
PyPI Package: clickhouse-connect>=1.8.0,<2.0
clickhousedb://{username}:{password}@{host}:{port}/{database}
Connection Examples
ClickHouse Cloud SQL playground (demo user, no password)
clickhousedb://demo:@sql-clickhouse.clickhouse.com:8443/uk?secure=true
ClickHouse Cloud (HTTPS)
clickhousedb://{username}:{password}@{host}:8443/{database}?secure=true
Altinity Cloud
clickhousedb://demo:demo@github.demo.trial.altinity.cloud/default?secure=true
Local (default user, no password, no TLS)
clickhousedb://default@localhost:8123/default
Supported Features
JOINsSubqueriesDynamic SchemaCatalog SupportDynamic CatalogSSH TunnelingQuery CancellationFile UploadUser ImpersonationCost EstimationSQL Validation
Feature Score: 61/201
Time Grains
Common Time Grains:
SECONDMINUTEHOURDAYWEEKMONTHQUARTERYEAR
Extended Time Grains:
FIVE_SECONDSTHIRTY_SECONDSFIVE_MINUTESTEN_MINUTESFIFTEEN_MINUTESTHIRTY_MINUTESHALF_HOURSIX_HOURSWEEK_STARTING_SUNDAYWEEK_STARTING_MONDAYWEEK_ENDING_SATURDAYWEEK_ENDING_SUNDAYQUARTER_YEAR
Extended Aggregate Functions
The base aggregates (SUM, COUNT, AVG, MIN, MAX, COUNT DISTINCT) are supported everywhere; these are opt-in per engine.
MEDIANSTDDEV_SAMPVAR_SAMP
Compatible Databases
The following databases are compatible with the ClickHouse driver:
ClickHouse CloudClickHouse CloudClickHouse Cloud
ClickHouse Cloud is the official fully-managed cloud service for ClickHouse. It provides automatic scaling, built-in backups, and enterprise security features.
clickhousedb://{username}:{password}@{host}:8443/{database}?secure=true
Parameters:
ParameterDescription
usernameDatabase username from the service Connect dialog (default: default)
passwordURL-encoded database password from the service Connect dialog
hostHTTPS hostname from the service Connect dialog
databaseDatabase name (default)
Altinity.CloudAltinity.CloudAltinity.Cloud
Altinity.Cloud is a managed ClickHouse service providing Kubernetes-native deployments with enterprise support.
clickhousedb://{username}:{password}@{host}/{database}?secure=true
Help improve this documentation by editing the engine spec: