From 336acaae5cfaf33a87e4dda5baa8b864b4045ff0 Mon Sep 17 00:00:00 2001 From: Robbie Coomber Date: Tue, 5 Dec 2023 12:45:26 +0000 Subject: [PATCH] Recreate data as part of resetting tables --- posthog/conftest.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/posthog/conftest.py b/posthog/conftest.py index c3b7a6281cabb0..5cb8164a73d1a0 100644 --- a/posthog/conftest.py +++ b/posthog/conftest.py @@ -15,6 +15,7 @@ def create_clickhouse_tables(num_tables: int): CREATE_DISTRIBUTED_TABLE_QUERIES, CREATE_MERGETREE_TABLE_QUERIES, CREATE_DATA_QUERIES, + CREATE_DICTIONARY_QUERIES, build_query, ) @@ -25,12 +26,15 @@ def create_clickhouse_tables(num_tables: int): if num_tables == len(CREATE_TABLE_QUERIES): return - queries = list(map(build_query, CREATE_TABLE_QUERIES)) - run_clickhouse_statement_in_parallel(queries) + table_queries = list(map(build_query, CREATE_TABLE_QUERIES)) + run_clickhouse_statement_in_parallel(table_queries) data_queries = list(map(build_query, CREATE_DATA_QUERIES)) run_clickhouse_statement_in_parallel(data_queries) + dictionary_queries = list(map(build_query, CREATE_DICTIONARY_QUERIES)) + run_clickhouse_statement_in_parallel(dictionary_queries) + def reset_clickhouse_tables(): # Truncate clickhouse tables to default before running test @@ -76,6 +80,12 @@ def reset_clickhouse_tables(): run_clickhouse_statement_in_parallel(TABLES_TO_CREATE_DROP) + from posthog.clickhouse.schema import ( + CREATE_DATA_QUERIES, + ) + + run_clickhouse_statement_in_parallel(list(CREATE_DATA_QUERIES)) + @pytest.fixture(scope="package") def django_db_setup(django_db_setup, django_db_keepdb):