Skip to main content

ClickHouse SQLAlchemy Dialect with timezone support

Project description

sqlalchemy-clickhouse-timezone

add timezone support

Installation

The package is installable through PIP:

pip install sqlalchemy-clickhouse-timezone

Usage

setting the environ param to start timezone support

default is ‘0’ using pytz.utc

‘CLICKHOUSE_USE_TIMEZONE’: ‘0’ => using utc

‘CLICKHOUSE_USE_TIMEZONE’: ‘1’ => using system timezone

‘CLICKHOUSE_USE_TIMEZONE’: ‘Asia/Shanghai’ => using configed Asian/Shanghai

configed

os.environ.setdefault(‘CLICKHOUSE_USE_TIMEZONE’, ‘0’)

os.environ.setdefault(‘CLICKHOUSE_USE_TIMEZONE’, ‘1’)

os.environ.setdefault(‘CLICKHOUSE_USE_TIMEZONE’, ‘Asia/Shanghai’)

‘infi.clickhouse_orm==1.0.4’

original project usage…

ClickHouse dialect for SQLAlchemy.

The DSN format is similar to that of regular Postgres:

>>> import sqlalchemy as sa
>>> sa.create_engine('clickhouse://username:password@hostname:port/database')
Engine('clickhouse://username:password@hostname:port/database')

It implements a dialect, so there’s no user-facing API.

Testing

The dialect can be registered on runtime if you don’t want to install it as:

from sqlalchemy.dialects import registry
registry.register("clickhouse", "base", "dialect")

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

sqlalchemy_clickhouse_timezone-0.1.4.tar.gz (13.4 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: sqlalchemy_clickhouse_timezone-0.1.4.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.4

File hashes

Hashes for sqlalchemy_clickhouse_timezone-0.1.4.tar.gz
Algorithm Hash digest
SHA256 aedeed6ecaee046c9de71da4f61800e13ec3e1906e021208faa2a067679680e9
MD5 94a28545f82147e8617c4c27f4e72d5b
BLAKE2b-256 3ab5817c7187df2b4f8ca45fb60b51787547e5f6c363d50ff6c5e2b4ae809a9e

See more details on using hashes here.

Supported by

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