diff --git a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/testing.md b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/testing.md index 584a200d7c..32a3343fc7 100644 --- a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/testing.md +++ b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/testing.md @@ -97,6 +97,7 @@ The trailing `SELECT 1` is required as a ceremonial closing statement. | `__expected__` | Define expected output for a model. SQLBuild resolves the model's real SQL and compares both ways on the listed columns. | | `__assert__` | Zero-row assertion. Passes if the query returns no rows; fails with the returned rows as diagnostics. | | `__macro__` | Mock a macro. Replaces every `@(...)` call with the mock value. | +| 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__`, so `__helper__` names are reserved. | Any CTE without one of these prefixes is treated as a helper CTE, available to mock, helper, `__expected__`, and `__assert__` SQL in the test. Models never see helpers: a model's own CTEs and diff --git a/website/src/content/docs/docs/concepts/testing.mdx b/website/src/content/docs/docs/concepts/testing.mdx index a5eb68167a..606e25bcc5 100644 --- a/website/src/content/docs/docs/concepts/testing.mdx +++ b/website/src/content/docs/docs/concepts/testing.mdx @@ -73,6 +73,7 @@ The trailing `SELECT 1` is required as a ceremonial closing statement. | `__expected__` | Define expected output for a model. SQLBuild resolves the model's real SQL and compares both ways on the listed columns. | | `__assert__` | Zero-row assertion. Passes if the query returns no rows; fails with the returned rows as diagnostics. | | `__macro__` | Mock a macro. Replaces every `@(...)` call with the mock value. | +| 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__`, so `__helper__` names are reserved. | Any CTE without one of these prefixes is treated as a helper CTE, available to mock, helper, `__expected__`, and `__assert__` SQL in the test. Models never see helpers: a model's own CTEs and