Skip to content

Commit

Permalink
debug- show all related logs from query log with query start time
Browse files Browse the repository at this point in the history
  • Loading branch information
BentsiLeviav committed Aug 20, 2024
1 parent d41dfa6 commit 8d0425a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/integration/adapter/projections/test_projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def models(self):
return {
"people_with_projection.sql": PEOPLE_MODEL_WITH_PROJECTION % "table",
"distributed_people_with_projection.sql": PEOPLE_MODEL_WITH_PROJECTION
% "distributed_table",
% "distributed_table",
}

def test_create_and_verify_projection(self, project):
Expand Down Expand Up @@ -117,12 +117,21 @@ def test_create_and_verify_distributed_projection(self, project):
print(show_create)
# check that the latest query used the projection
result = project.run_sql(
f"SELECT query, query_start_time, projections FROM clusterAllReplicas(default, 'system.query_log') "
f"SELECT query, toString(query_start_time, 'UTC'),read_rows, projections FROM clusterAllReplicas(default, 'system.query_log') "
f"WHERE query like '%{project.test_schema}.{relation.name}%' ORDER BY query_start_time DESC",
# f"and query not like '%system.query_log%' and read_rows > 0 ORDER BY query_start_time DESC",
fetch="all",
)
print("query log res are:")
print("query logs are:")
print(result)

result = project.run_sql(
f"SELECT query, projections FROM clusterAllReplicas(default, 'system.query_log') "
f"WHERE query like '%{project.test_schema}.{relation.name}%' ORDER BY query_start_time DESC"
f"and query not like '%system.query_log%' and read_rows > 0 ORDER BY query_start_time DESC",
fetch="all",
)
print("assertion input res:")
print(result)
assert len(result) > 0
assert query in result[0][0]
Expand Down

0 comments on commit 8d0425a

Please sign in to comment.