Skip to main content

An experimental wrapper around aiochclient to use it with SQLAlchemy

Project description

An experimental wrapper around aiochclient to use it with SQLAlchemy

Example

import aiochsa
import sqlalchemy as sa

table = sa.Table(
    sa.Column('id', sa.Integer),
    sa.Column('name', sa.String),
)

async with aiochsa.connect('clickhouse://127.0.0.1:8123') as conn:
    await conn.execute(
        table.insert(),
        [
            {'id': 1, 'name': 'Alice'},
            {'id': 2, 'name': 'Bob'},
        ],
    )
    rows = await conn.fetch(
        table.select()
    )

Custom type converters

Here is an example of installing converter for ClickHouse’s DateTime type that requires and returns timezone-aware Python’s datetime object and stores it as UTC:

from datetime import datetime
import aiochsa
from aiochsa.types import DateTimeUTCType, TypeRegistry

types = TypeRegistry()
types.register(DateTimeUTCType, ['DateTime'], datetime)
conn = aiochsa.connect(dsn, types=types)

Change log

See CHANGELOG.

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

aiochsa-0.3.tar.gz (13.0 kB view details)

Uploaded Source

File details

Details for the file aiochsa-0.3.tar.gz.

File metadata

  • Download URL: aiochsa-0.3.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for aiochsa-0.3.tar.gz
Algorithm Hash digest
SHA256 dab6fd48f45e9b9cbadd8247825aa1075b308e618910a92713df403f9c65f7a0
MD5 6b4e8bf67f08565d35ea0da6c29ca2f8
BLAKE2b-256 69ab3401dade5b6caea48118b749005ad34bd1daea9b370ba500275b960e43a9

See more details on using hashes here.

Supported by

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