You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e32060d
Browse filesBrowse the repository at this point in the historyBrowse files
|`physical`|`create`, `materialize`, `schema_migration`|`snapshot`; `target` when known; `creating` for materialization; `existed` for schema migration when known |
93
111
|`virtual`|`promote`, `demote`|`snapshot`; `target` when known; `source_table` for promotion when known |
94
112
|`audit`|`audit`|`audit_name`; `audit_result` at finish if produced |
95
113
|`query`|`execute`|`engine` dialect string |
96
114
97
-
`Snapshot` and `AuditResult` values are borrowed native objects. Treat them and
98
-
other nested values as read-only, and do not retain them beyond finish. The
99
-
mapping's read-only wrapper does not freeze these objects. Normalize any values
100
-
needed for later processing during the callback; facts are not a JSON event
101
-
schema. SQLMesh does not interpret audit results as consumer statuses or inherit
102
-
model facts into child mappings.
103
-
104
-
Audit observations finish before later audits or WAP publication can fail. An
105
-
audit query failure can produce a finish callback without an `AuditResult`.
106
-
Physical materialization includes the surrounding transaction/session exit.
107
-
An invocation can perform no work, multiple statements, or internal driver
108
-
retries; observations are not an expected-work manifest or a retry inventory.
109
-
110
-
The query boundary surrounds the base adapter's existing SQL logging and
111
-
`_execute` call. It does not include a surrounding transaction's commit or later
112
-
fetch/result consumption. Adapter paths that bypass this boundary, including
113
-
BigQuery session queries and dataframe loads and ClickHouse dataframe inserts,
114
-
do not necessarily produce query observations. These hooks therefore do not
115
-
provide a complete warehouse activity history or a transaction-success guarantee.
116
-
117
-
SQL logs retain their existing behavior, including VALUES redaction for
118
-
non-query expressions. The callback does not receive SQL text, adapter objects,
119
-
or warehouse query IDs. Starting the observation before SQL logging lets a
120
-
consumer associate existing logs with the invocation.
115
+
`Snapshot` and `AuditResult` values are borrowed native objects. Consumers must
116
+
treat these objects and other nested values as read-only and must not retain them
117
+
beyond the matching `finish` callback. The mapping's read-only wrapper does not
118
+
freeze nested objects. Facts are not a JSON event schema. SQLMesh does not
119
+
interpret audit results as consumer statuses or inherit model facts into child
120
+
mappings. Consumers that need facts after `finish` copy and normalize those
121
+
values during the callback.
122
+
123
+
SQLMesh calls `finish` for an audit before it runs later audits or publishes WAP
124
+
results. A later audit or publication can still fail. An audit query failure can
125
+
produce a `finish` callback without an `AuditResult`. The physical materialization
126
+
callback ends after its surrounding transaction and session exit.
127
+
128
+
An observed operation can do no work, issue multiple statements, or trigger
129
+
internal driver retries. The observation does not predict how many statements
130
+
the operation will issue or report each retry.
131
+
132
+
The query observation surrounds the base adapter's existing SQL logging and
133
+
`_execute` call. It ends before a surrounding transaction commits and before
134
+
later fetch or result consumption. Some adapter operations do not call this
135
+
query hook. BigQuery session queries, BigQuery dataframe loads, and ClickHouse
136
+
dataframe inserts may not produce query observations. These hooks do not provide
137
+
a complete warehouse activity history or guarantee transaction success.
138
+
139
+
SQL logging retains its existing behavior, including VALUES redaction for
140
+
non-query expressions. The callback receives no SQL text, adapter objects, or
141
+
warehouse query IDs. The `start` callback runs before SQL logging. Consumers can
142
+
use that ordering to associate existing log entries with the invocation.
121
143
122
144
## Worker context
123
145
124
-
When observation is active, the instrumented scheduler and snapshot DAG dispatch
125
-
paths copy the admitting context at execution time. Snapshot schema creation and
126
-
data-object listing also copy the context for each admitted value. Each node or
127
-
value runs in its own copy, including serial execution. Consumer-owned
128
-
`ContextVar` values can therefore carry parent identities into workers;
129
-
successors inherit the admission context rather than the preceding worker's
130
-
changes. Reusing a DAG executor captures a fresh context for each run.
131
-
132
-
Context copies are shallow. Mutable objects stored in ContextVars can still be
133
-
shared; consumers should use immutable values or replace values instead of
134
-
mutating shared state. This behavior applies to these instrumented scheduler,
135
-
DAG, schema-creation, and data-object-listing paths, not to arbitrary consumer
136
-
threads or every SQLMesh concurrency helper.
137
-
138
-
With no observer registered, these call sites do not opt into context copying;
139
-
ContextVars keep the concurrency helper's existing serial and worker behavior.
146
+
Outside callback delivery, an active observer makes
0 commit comments