Registry / database / infi-clickhouse-orm

infi-clickhouse-orm

JSON →
library2.1.3pypypiunverified

A Python ORM-like library for interacting with ClickHouse databases, providing high-level abstractions for creating, querying, and manipulating data. Current version: 2.1.3. Release cadence is irregular.

pip install infi-clickhouse-orm
INSTALL
IMPORT
SIG · INFI-CLICKHOUSE-OR
I
infi-clickhouse-orm
databasepythonv2.1.3
Install
2.5s avg
Import
987ms
Disk
26MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.650s · 24.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.5s · import 0.534s · 25MB
26MB installed
● package 26MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Database
from infi.clickhouse_orm import Database
from infi.clickhouse_orm import Database

Basic usage: define a model, create table, insert and query data.

from infi.clickhouse_orm import Database, Model, StringField, Int32Field class Person(Model): name = StringField() age = Int32Field() tablename = 'persons' # Connect to ClickHouse (adjust host/port as needed) db = Database('default', db_url='http://localhost:8123/') db.create_table(Person) # Insert a record person = Person(name='Alice', age=30) db.insert([person]) # Query results = db.select('SELECT * FROM persons') for row in results: print(row.name, row.age)
Debug
Known issues
gotchaTable names are case-sensitive and must match the database schema. The ORM does not automatically lowercase or uppercase table names.
fix
Explicitly set tablename attribute in Model subclasses to match existing tables.
affects: >=2.0.0
breakingIn version 2.0.0, the import path changed from clickhouse_orm to infi.clickhouse_orm. Old code using from clickhouse_orm import ... will break.
fix
Change import statements to from infi.clickhouse_orm import ...
affects: 2.0.0 and later
gotchaThe insert() method expects a list of model instances; inserting a single instance without wrapping in a list causes a TypeError.
fix
Always pass a list: db.insert([instance])
affects: All
Upgrade
Version history
2.1.3latest on PyPI · released Nov 29, 2022
Audit
Dependencies
clickhouse-driverrequiredUsed internally for database connection
python-dateutilrequiredDate parsing utilities
pytzrequiredTimezone support
Agent activity
6 hits · last 30 days
node
6
Resources
infi-clickhouse-orm — pip install infi-clickhouse-orm · libregistry