clickhouse-df
请求 clickhouse集群,结果返回pandas.DataFrame/polars.DataFrame
安装
pip install -U clickhouse-df
示例
import clickhouse_df
# 版本
print(clickhouse_df.__version__)
# 集群配置
config = dict(
urls=["<host1>:<port>", "<host2>:<port>", ....],
user="<user_name>",
password="xxxxxx",
)
sql = "select * from <db_name>.<tb_name> where date='2024-10-23';"
# 例子1
with clickhouse_df.connect(**config):
# 请求 polars
df_pl = clickhouse_df.to_polars(sql)
# 请求 pandas
df_pd = clickhouse_df.to_pandas(sql)
# 例子2
conn = clickhouse_df.connect(**config)
df_pl = clickhouse_df.to_polars(sql, conn)
df_pd = clickhouse_df.to_pandas(sql, conn)
conn.disconnect()
Metadata
Release files for clickhouse-df 2026.9.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clickhouse_df-2026.9.7.0.tar.gz | 45.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clickhouse_df-2026.9.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.7 kB
Release files / clickhouse_df-2026.9.7.0.tar.gz
| Download URL | clickhouse_df-2026.9.7.0.tar.gz |
|---|---|
| Size | 45.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f02d226bac3638e6fc08421a95b337b4bafbf999a165c8c42041192e939f0bfc
|
|
BLAKE2b-256 checksum How to use checksums |
2f79a83d1978bd7d3e8ea8bce69cb4f5dbc6ef853dd310548baca82c3ef23edd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.7
|
Release files / clickhouse_df-2026.9.7.0-py3-none-any.whl
| Download URL | clickhouse_df-2026.9.7.0-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c6f714f831bf380c84bf3645a6a8867056b9e6b0aac5836cfec5ad07bb867fa
|
|
BLAKE2b-256 checksum How to use checksums |
5e677a8da4f967521691235d729b713127f55814cdcd39fdb69611bf5bb0b6de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.7
|