Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(test): patch run_chdb_query instead of chdb.query in warehouse test (#68855)

mendral-app[bot]c49487b63b20
diff --git a/products/data_warehouse/backend/models/test/test_table.py b/products/data_warehouse/backend/models/test/test_table.py
index 9ffc9a207d64..a8f23e81b916 100644
--- a/products/data_warehouse/backend/models/test/test_table.py
+++ b/products/data_warehouse/backend/models/test/test_table.py
@@ -484,15 +484,14 @@ class TestTable(BaseTest):
team=self.team,
)
- chdb_result = type("R", (), {"__str__": lambda self: chdb_csv})()
with (
patch("products.warehouse_sources.backend.models.table.TEST", False),
- patch("chdb.query", return_value=chdb_result) as chdb_query,
+ patch("products.warehouse_sources.backend.models.table.run_chdb_query", return_value=chdb_csv) as mock_run,
):
getattr(table, method_name)()
- assert chdb_query.called, "chdb.query should have been invoked on the chdb path"
- rendered_query: str = chdb_query.call_args.args[0]
+ assert mock_run.called, "run_chdb_query should have been invoked on the chdb path"
+ rendered_query: str = mock_run.call_args.args[0]
assert malicious_secret not in rendered_query, (
f"Unescaped secret leaked into chdb query, enabling SQL injection: {rendered_query}"
)