ClickHouse¶
ibis.memtable
Support ¶
The ClickHouse backend supports memtable
s by natively executing queries against the underlying storage (e.g., pyarrow Tables or pandas DataFrames).
Install¶
Install ibis
and dependencies for the ClickHouse backend:
pip install 'ibis-framework[clickhouse]'
conda install -c conda-forge ibis-clickhouse
mamba install -c conda-forge ibis-clickhouse
Connect¶
ibis.clickhouse.connect
¶
con = ibis.clickhouse.connect(
user="username",
password="password",
host="hostname",
)
ibis.clickhouse.connect
is a thin wrapper around ibis.backends.clickhouse.Backend.do_connect
.
Connection Parameters¶
do_connect(host='localhost', port=None, database='default', user='default', password='', client_name='ibis', secure=None, compression=True, **kwargs)
¶
Create a ClickHouse client for use with Ibis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host |
str
|
Host name of the clickhouse server |
'localhost'
|
port |
int | None
|
ClickHouse HTTP server's port. If not passed, the value depends on
whether |
None
|
database |
str
|
Default database when executing queries |
'default'
|
user |
str
|
User to authenticate with |
'default'
|
password |
str
|
Password to authenticate with |
''
|
client_name |
str
|
Name of client that will appear in clickhouse server logs |
'ibis'
|
secure |
bool | None
|
Whether or not to use an authenticated endpoint |
None
|
compression |
str | bool
|
The kind of compression to use for requests. See https://clickhouse.com/docs/en/integrations/python#compression for more information. |
True
|
kwargs |
Any
|
Client specific keyword arguments |
{}
|
ibis.connect
URL format¶
In addition to ibis.clickhouse.connect
, you can also connect to ClickHouse by
passing a properly formatted ClickHouse connection URL to ibis.connect
con = ibis.connect(f"clickhouse://{user}:{password}@{host}:{port}?secure={secure}")
ClickHouse playground¶
ClickHouse provides a free playground with several datasets that you can connect to using ibis
:
con = ibis.clickhouse.connect(
host="play.clickhouse.com",
secure=True,
user="play",
password="clickhouse",
)
or
con = ibis.connect("clickhouse://play:clickhouse@play.clickhouse.com:443?secure=True")