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.3.tar.gz (40.9 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.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for clickhouse_df-0.1.3.tar.gz
Algorithm Hash digest
SHA256 66f274dfe3658c0da1e5de85ff425c1e0643c6ceeb8492bbf0402f8467aaf464
MD5 ce0e87501ca0568d947eea2e54e33946
BLAKE2b-256 b55e779a628676a91726479d6ab46b9b8fef15f104c3e2f5e7fd2d8fc10a26c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for clickhouse_df-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0621dd45d6196f352a1a80e9e6a2063d0f5539004e0a7451ab14573d397a5d45
MD5 8ecb620371f49020f0d967a7d0ed9a54
BLAKE2b-256 7432250495e450423c023f92559db89593f4eda036c798f86a35a5e9eca057fb

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