0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/ee/clickhouse
Eric Duong e4f65b1790
8356 versioning (#8449)
* version insights

* version and lock update

* make sure all tests work

* restore exception

* fix test

* fix test

* add specific id

* update plugin server test utils

* cleanup

* match filtering

* use timestamp comparison

* make tests work

* one more test field

* fix more tests

* more cleanup

* lock frontend when updating and restore refresh

* pass undefined

* add timestamp to background update

* use incrementer

* add field

* snapshot

* types

* more cleanup

* update tests

* remove crumbs

* use expressions

* make nullable

* batch delete

* fill null for static cohorts

* batch_delete

* typing

* remove queryset function
2022-02-09 12:19:00 -05:00
..
bin
materialized_columns Use structlog over logging (#8155) 2022-01-20 10:48:06 +02:00
migrations Add tags to dead letter queue table (#8345) 2022-02-04 15:36:15 -05:00
models 8356 versioning (#8449) 2022-02-09 12:19:00 -05:00
queries 8356 versioning (#8449) 2022-02-09 12:19:00 -05:00
sql 8356 versioning (#8449) 2022-02-09 12:19:00 -05:00
test Add dead letter queue metrics to system status (#8294) 2022-01-31 15:10:10 -03:00
views Add support for Groups in Experiments (#8463) 2022-02-09 15:32:54 +00:00
__init__.py
client.py fix(retention): add regression test for not_icontains filter (#7748) 2021-12-17 10:13:38 +00:00
demo.py Update mypy and typed-ast, fail early if db version not in range (#7599) 2021-12-10 09:29:04 +01:00
errors.py
middleware.py Yeetcode (#7830) 2022-01-18 14:32:28 -05:00
README.md Remove references to 'CLICKHOUSE_INITIAL_MIGRATIONS' (#7960) 2022-01-10 12:14:50 +02:00
system_status.py Dead letter queue initial metrics dashboard (#8347) 2022-02-03 14:56:18 -05:00
timer.py Use structlog over logging (#8155) 2022-01-20 10:48:06 +02:00
util.py reintroduce assertNumQueries (#8487) 2022-02-09 16:15:17 +00:00

Clickhouse Support (Enterprise Feature)

To accomodate high volume deployments, Posthog can use Clickhouse instead of Postgres. Clickhouse isn't used by default because Postgres is easier to deploy and maintain on smaller instances and on platforms such as Heroku.

Clickhouse Support works by swapping in separate queries and classes in the system for models that are most impacted by high volume usage (ex: events and actions).

Migrations and Models

The django_clickhouse orm is used to manage migrations and models. The ORM is used to mimic the django model and migration structure in the main folder.

Queries

Queries parallel the queries folder in the main folder however, clickhouse queries are written in SQL and do not utilize the ORM.

Tests

The tests are inherited from the main folder. The Clickhouse query classes are based off BaseQuery so their run function should work just as the Django ORM backed query classes. These classes are called with the paramterized tests declared in the main folder which allows the same suite of tests to be run with different implementations.

Views

Views contain Viewset classes that are not backed by models. Instead the views query Clickhouse tables using SQL. These views match the interface provide by the views in the main folder.