Skip to main content

good-clickhouse

A Clickhouse client with fast_depends based dependency injection.

Sync:

from fast_depends import inject
from good_clickhouse import Clickhouse, ClickhouseProvider


@inject
def some_task(
    clickhouse: Clickhouse = ClickhouseProvider(),
):
    with clickhouse.cursor() as cursor:
        cursor.execute('SELECT 1')
        return cursor.fetchall()

Async:

from fast_depends import inject
from good_clickhouse import ClickhouseAsync, ClickhouseAsyncProvider


@inject
async def some_task(
    clickhouse: ClickhouseAsync = ClickhouseAsyncProvider(),
):
    async with clickhouse as client:
        results = await client.execute('SELECT 1')
        return results

@query decorator utility for composing queries.

from good_clickhouse import query

@query
def complex_query(table_name: str, columns: list[str], filters: dict[str, str]):
    """
    select {{ columns | join(', ') }}
    from {{ table_name }}
    where {% for key, value in filters.items() -%}
            {{ key }} {{ value }}{% if not loop.last %} and {% endif %}
          {%- endfor %};
    """


columns = ["id", "name", "age"]
filters = {"age": "> 20", "name": "like 'John%'"}
rendered_query = complex_query("users", columns, filters)
print(rendered_query)
"""
> select id, name, age
> from users
> where age > 20 and name like 'John%'
"""

Release files for good-clickhouse 0.2.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for good-clickhouse 0.2.24
File Size Uploaded
good_clickhouse-0.2.24.tar.gz 62.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for good-clickhouse 0.2.24
File Interpreter ABI Platform
good_clickhouse-0.2.24-py3-none-any.whl Python 3 none any Details

Total release size: 74.4 kB

Release files / good_clickhouse-0.2.24.tar.gz

Download URL good_clickhouse-0.2.24.tar.gz
Size 62.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a2e0b739c4d1541da8948e92859d531ff56bf8ee95d210b08cf37b650f5f0eee
BLAKE2b-256 checksum
How to use checksums
c2153a70c3b0c24faf174118fdcbdaf3a1a00f1391d707053133535ed99c543a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11

Release files / good_clickhouse-0.2.24-py3-none-any.whl

Download URL good_clickhouse-0.2.24-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fabe88c6634b4ee2bc3a853c04b4766117b409dd38585e208ec5c0fa1a277f20
BLAKE2b-256 checksum
How to use checksums
9d8ffaca2b10cfc82ec42fb58f9bd6a478fe1f47f02acb976a27239901de95b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11

Release history Release notifications | RSS feed

This release

0.2.24 This release

2 release files

0.2.22

2 release files

0.2.19

2 release files

0.2.18

2 release files

0.2.16

1 release file

0.2.15

2 release files

0.2.14

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page