Skip to main content

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.4.tar.gz (39.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clickhouse_df-0.1.4-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file clickhouse_df-0.1.4.tar.gz.

File metadata

  • Download URL: clickhouse_df-0.1.4.tar.gz
  • Upload date:
  • Size: 39.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.7

File hashes

Hashes for clickhouse_df-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d4c25514ec24856e06572aef031a02d8a6ff3c106806864e4ddf2a2701402b60
MD5 fb5f0b56fdae9d1b5fcae52214d743a5
BLAKE2b-256 df1c585f7d579bd6c895ca5fc1ac939a7d1c05e2b46d94faa8313d086b6e31b7

See more details on using hashes here.

File details

Details for the file clickhouse_df-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for clickhouse_df-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 492aa416eb885a298cb49937f6ba3991e2291d0a97089eb761705fb626ff0b3a
MD5 b7f3dbfdf791d53bcc7048fbeffebdf9
BLAKE2b-256 4095b61d81e64e8cdff61d1304574d551bc9a55590ef0f3d2d3cd042d0881b6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page