Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,11 @@ other (`P020`); compose them in the model by passing results, as in
a visible name.

A body may not call `__ref()`, `__source()` or `__seed()` (`P016`): pass relations in as `RELATION`
arguments. `@const(...)` and `@enum(...)` in a body resolve from the macro file's own folder, like
audits and unlike Python macros; one that is not visible from there fails with `S026`. Make it a
parameter and pass the value from the caller instead. SQL macros a body calls resolve the same way,
so a macro can call a folder-local macro beside it that its callers cannot see.
arguments. `@const(...)` and `@enum(...)` in a body resolve from the macro file's folder, not from
the calling model, so a macro means the same thing wherever it's called. A constant or enum that
isn't visible from there fails with `S026`; to use a caller's value, make it an argument and pass
`@const(...)` at the call site. SQL macros a body calls resolve the same way, so a macro can call a
folder-local macro beside it that its callers cannot see.

## Checks and tools

Expand Down
8 changes: 4 additions & 4 deletions website/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,14 @@ <h3>Archive old tables before deleting them</h3>
<div class="step">
<div class="step-text">
<span class="num">09 · Investigate</span>
<h3>Find out what happened, then check what's true now</h3>
<h3>Look back at past runs</h3>
<p>
SQLBuild records every run: what ran, the SQL it executed, audit results and everything it printed. You or an agent can query that history in SQL, and the same command queries the warehouse to check what's true now.
SQLBuild keeps a record of every run: what ran, the SQL, audit results and the output. Query it in SQL, and query the warehouse with the same command.
</p>
<p>
Here an audit started warning on the latest run, but the build still exited 0. The first two commands show when it started and what the run printed. The third finds the cause, still in prod: a refund stored as a negative payment.
Here an audit started warning but the build still passed. Two queries find when it started and what the run printed; a third finds the bad row, still in prod.
</p>
<p>History lives in a SQLite file in your project, or in ClickHouse for a team. No service to run, no account, no paid tier.</p>
<p>The record is a SQLite file in your project, or ClickHouse for a team.</p>
<p class="more"><a href="/docs/concepts/observability/recall/">How Recall works →</a></p>
</div>
<pre class="terminal"><span class="cmd">sqb recall query &quot;SELECT substr(a.invocation_started_at, 1, 16) AS run,
Expand Down
9 changes: 5 additions & 4 deletions website/src/content/docs/docs/concepts/macros/sql-macros.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,11 @@ other (`P020`); compose them in the model by passing results, as in
a visible name.

A body may not call `__ref()`, `__source()` or `__seed()` (`P016`): pass relations in as `RELATION`
arguments. `@const(...)` and `@enum(...)` in a body resolve from the macro file's own folder, like
audits and unlike Python macros; one that is not visible from there fails with `S026`. Make it a
parameter and pass the value from the caller instead. SQL macros a body calls resolve the same way,
so a macro can call a folder-local macro beside it that its callers cannot see.
arguments. `@const(...)` and `@enum(...)` in a body resolve from the macro file's folder, not from
the calling model, so a macro means the same thing wherever it's called. A constant or enum that
isn't visible from there fails with `S026`; to use a caller's value, make it an argument and pass
`@const(...)` at the call site. SQL macros a body calls resolve the same way, so a macro can call a
folder-local macro beside it that its callers cannot see.

## Checks and tools

Expand Down
Loading