Read ClickHouse Cluster Data To Pandas/Polars DataFrame
Project description
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()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
clickhouse_df-0.1.5.tar.gz
(39.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clickhouse_df-0.1.5.tar.gz.
File metadata
- Download URL: clickhouse_df-0.1.5.tar.gz
- Upload date:
- Size: 39.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b50b76153b63868554406afec4eacbcfeec0c88b171cd2da9f07a9dd659e034f
|
|
| MD5 |
ba26bc1b8243b1cdbf33b0e16685c14d
|
|
| BLAKE2b-256 |
a9ea3af90def596b09ab557aefd8258c406b2fab1e2b433b7fde84f092c2fc59
|
File details
Details for the file clickhouse_df-0.1.5-py3-none-any.whl.
File metadata
- Download URL: clickhouse_df-0.1.5-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff44278e0d41850219b762b4c4ef25e676e04c8371c5bce5197f1505e9da54a8
|
|
| MD5 |
ddba33b389e2400b7e1484bd490b060f
|
|
| BLAKE2b-256 |
08f1f07cc0deee6cf335b4223831f5a2bdc4d8771c48b6149494cb8d28d65241
|