Skip to content

Commit 6d5bf66

Browse files
committed
docs: list helper CTEs in the testing CTE conventions table
1 parent d4c7157 commit 6d5bf66

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

  • src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts
  • website/src/content/docs/docs/concepts

‎src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/testing.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ The trailing `SELECT 1` is required as a ceremonial closing statement.
9797
| `__expected__<name>` | Define expected output for a model. SQLBuild resolves the model's real SQL and compares both ways on the listed columns. |
9898
| `__assert__<name>` | Zero-row assertion. Passes if the query returns no rows; fails with the returned rows as diagnostics. |
9999
| `__macro__<name>` | Mock a macro. Replaces every `@<name>(...)` call with the mock value. |
100+
| any other name | Helper CTE, shared by the test's mocks, helpers, `__expected__` and `__assert__` CTEs. Models never see it, so it can share a name with a model's CTE or a table. It is emitted as `__helper__<name>`, so `__helper__` names are reserved. |
100101

101102
Any CTE without one of these prefixes is treated as a helper CTE, available to mock, helper,
102103
`__expected__`, and `__assert__` SQL in the test. Models never see helpers: a model's own CTEs and

‎website/src/content/docs/docs/concepts/testing.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ The trailing `SELECT 1` is required as a ceremonial closing statement.
7373
| `__expected__<name>` | Define expected output for a model. SQLBuild resolves the model's real SQL and compares both ways on the listed columns. |
7474
| `__assert__<name>` | Zero-row assertion. Passes if the query returns no rows; fails with the returned rows as diagnostics. |
7575
| `__macro__<name>` | Mock a macro. Replaces every `@<name>(...)` call with the mock value. |
76+
| any other name | Helper CTE, shared by the test's mocks, helpers, `__expected__` and `__assert__` CTEs. Models never see it, so it can share a name with a model's CTE or a table. It is emitted as `__helper__<name>`, so `__helper__` names are reserved. |
7677

7778
Any CTE without one of these prefixes is treated as a helper CTE, available to mock, helper,
7879
`__expected__`, and `__assert__` SQL in the test. Models never see helpers: a model's own CTEs and

0 commit comments

Comments
 (0)