@@ -27,9 +27,7 @@ def pytest_configure() -> None:
27
27
Set up the Sentry SDK to avoid errors hidden by configuration.
28
28
Ensure the snuba_test database exists
29
29
"""
30
- assert (
31
- settings .TESTING
32
- ), "settings.TESTING is False, try `SNUBA_SETTINGS=test` or `make test`"
30
+ assert settings .TESTING , "settings.TESTING is False, try `SNUBA_SETTINGS=test` or `make test`"
33
31
34
32
initialize_snuba ()
35
33
setup_sentry ()
@@ -52,9 +50,11 @@ def create_databases() -> None:
52
50
storage_sets = cluster ["storage_sets" ],
53
51
single_node = cluster ["single_node" ],
54
52
cluster_name = cluster ["cluster_name" ] if "cluster_name" in cluster else None ,
55
- distributed_cluster_name = cluster ["distributed_cluster_name" ]
56
- if "distributed_cluster_name" in cluster
57
- else None ,
53
+ distributed_cluster_name = (
54
+ cluster ["distributed_cluster_name" ]
55
+ if "distributed_cluster_name" in cluster
56
+ else None
57
+ ),
58
58
)
59
59
60
60
database_name = cluster ["database" ]
@@ -161,9 +161,7 @@ def _build_migrations_cache() -> None:
161
161
nodes = [* cluster .get_local_nodes (), * cluster .get_distributed_nodes ()]
162
162
for node in nodes :
163
163
if (cluster , node ) not in MIGRATIONS_CACHE :
164
- connection = cluster .get_node_connection (
165
- ClickhouseClientSettings .MIGRATE , node
166
- )
164
+ connection = cluster .get_node_connection (ClickhouseClientSettings .MIGRATE , node )
167
165
rows = connection .execute (
168
166
f"SELECT name, create_table_query FROM system.tables WHERE database='{ database } '"
169
167
)
@@ -195,14 +193,14 @@ def _clear_db() -> None:
195
193
or storage_key == StorageKey .EAP_ITEMS_DOWNSAMPLE_8
196
194
or storage_key == StorageKey .EAP_ITEMS_DOWNSAMPLE_64
197
195
or storage_key == StorageKey .EAP_ITEMS_DOWNSAMPLE_512
196
+ or storage_key == StorageKey .OUTCOMES_HOURLY
197
+ or storage_key == StorageKey .OUTCOMES_DAILY
198
198
):
199
199
table_name = schema .get_local_table_name () # type: ignore
200
200
201
201
nodes = [* cluster .get_local_nodes (), * cluster .get_distributed_nodes ()]
202
202
for node in nodes :
203
- connection = cluster .get_node_connection (
204
- ClickhouseClientSettings .MIGRATE , node
205
- )
203
+ connection = cluster .get_node_connection (ClickhouseClientSettings .MIGRATE , node )
206
204
connection .execute (f"TRUNCATE TABLE IF EXISTS { database } .{ table_name } " )
207
205
208
206
@@ -240,9 +238,7 @@ def clickhouse_db(
240
238
# apply migrations from cache
241
239
applied_nodes = set ()
242
240
for (cluster , node ), tables in MIGRATIONS_CACHE .items ():
243
- connection = cluster .get_node_connection (
244
- ClickhouseClientSettings .MIGRATE , node
245
- )
241
+ connection = cluster .get_node_connection (ClickhouseClientSettings .MIGRATE , node )
246
242
for table_name , create_table_query in tables .items ():
247
243
if (node .host_name , node .port , table_name ) in applied_nodes :
248
244
continue
0 commit comments