Skip to content

Commit 886c2a8

Browse files
committed
PR Feedback 1
1 parent ccd8651 commit 886c2a8

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

sqlmesh/core/test/definition.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,13 +601,22 @@ def test_ctes(self, ctes: t.Dict[str, exp.Expression], recursive: bool = False)
601601
for alias, cte in ctes.items():
602602
cte_query = cte_query.with_(alias, cte.this, recursive=recursive)
603603

604-
actual = self._execute(cte_query)
604+
with self._concurrent_render_context():
605+
# Similar to the model's query, we render the CTE query under the locked context
606+
# so that the execution (fetchdf) can continue concurrently between the threads
607+
sql = cte_query.sql(
608+
self._test_adapter_dialect, pretty=self.engine_adapter._pretty_sql
609+
)
610+
611+
actual = self._execute(sql)
605612
expected = self._create_df(values, columns=cte_query.named_selects, partial=partial)
606613

607614
self.assert_equal(expected, actual, sort=sort, partial=partial)
608615

609616
def runTest(self) -> None:
610617
with self._concurrent_render_context():
618+
# Render the model's query and generate the SQL under the locked context so that
619+
# execution (fetchdf) can continue concurrently between the threads
611620
query = self._render_model_query()
612621
sql = query.sql(self._test_adapter_dialect, pretty=self.engine_adapter._pretty_sql)
613622

0 commit comments

Comments
 (0)