Files
zeekay dda3979851 rename: the ORM is ours — datastore_orm, not infi.clickhouse_orm
This is our fork, so it should read like it. `import datastore_orm` instead of
`from infi.clickhouse_orm import ...`: `infi` was the original vendor's org
namespace, and carrying someone else's org name through every import in the
consuming codebase is not a fork, it is a vendored copy that never got renamed.

The `infi` namespace package is gone entirely (src/infi/__init__.py with it),
the distribution is `datastore-orm`, and the metadata points at Hanzo rather
than at the upstream repo and author.

NOT renamed, deliberately: the migration history tables are still
`infi_clickhouse_orm_migrations`. That name is persisted state — 448 rows in
production key off it — so changing it is a data migration, not a rename. Doing
it carelessly reproduces the exact failure this fork just hit, where a package
rename orphaned the history and silently blocked every migration.
2026-07-26 08:44:11 -07:00
..
2020-07-14 21:57:24 +03:00
2020-07-14 21:57:24 +03:00
2020-07-15 23:42:40 +03:00
2020-07-15 23:42:40 +03:00
2020-07-14 21:57:24 +03:00

DB Explorer

This is a simple Flask web application that connects to ClickHouse and displays the list of existing databases. Clicking on a database name drills down into it, showing its list of tables. Clicking on a table drills down further, showing details about the table and its columns.

For each table or column, the application displays the compressed size on disk, the uncompressed size, and the ratio between them. Additionally, several pie charts are shown - top tables by size, top tables by rows, and top columns by size (in a table).

The pie charts are generated using the pygal charting library.

ORM concepts that are demonstrated by this example:

  • Creating ORM models from existing tables using Database.get_model_for_table
  • Queryset filtering
  • Queryset aggregation

Running the code

Create a virtualenv and install the required libraries:

virtualenv -p python3.6 env
source env/bin/activate
pip install -r requirements.txt

Run the server and open http://127.0.0.1:5000/ in your browser:

python server.py

By default the server connects to ClickHouse running on http://localhost:8123/ without a username or password, but you can change this using command line arguments:

python server.py http://myclickhouse:8123/

or:

python server.py http://myclickhouse:8123/ admin secret123