Repository navigation
Commit c024aea
authored
fix: give Python node results and provider setup the selected target (#1529)
* fix: keep Python node results out of per-model target schemas
A target schema such as s_${CTX:model.name} resolves only inside a model.
sqb build passed the raw template to Python tasks and loaders as their
default location, so persisting a node result ran CREATE SCHEMA on the
template and the build failed. Build and check now fall back to the
adapter's default schema and database when the target location holds a
context placeholder.
* feat: set up exporter, sink and sensor providers with their target
Event exporters and command output sinks bind their providers when the
command starts, and that session is shared with build, check and load.
It was set up without the target, so a provider used by a sink got
setup(None) even inside sqb build. The scope now resolves the selected
target first and passes its settings; when the project can't resolve
them, ctx stays None and the command still runs.
A custom sensor's providers get the settings of the target the sensor
evaluates for. Calendars keep ctx None and the providers page says so.
* fix: fail build, check and load when the exporter target can't be resolved
Exporter and sink providers fell back to setup(None) whenever the
selected target couldn't be resolved, so a build with an undefined
connection set them up without a target before failing. build, check
and load now fail at startup instead, before any provider is set up.
Other commands, such as sqb format, still run and pass None. A sensor
evaluation fails rather than set its providers up without its target.
Target resolution at startup also runs with stdout sent to stderr in
machine-output modes, like extension discovery next to it.
* refactor: resolve exporter and sensor setup contexts in one helper
Exporter, sink and sensor providers now get their setup context from
one native host helper. It returns None when the project has no
providers, fails build, check and load on an unresolvable target, and
ignores the model name that mv, rename and scope take as TARGET.
* fix: fail every target command when exporter providers can't get the target
Compile, dag, plan, test, seed, query, freshness, audit and debug need
the target too, and already fail on an unresolvable one. They now fail
before setting up exporter and sink providers, like build, check and
load, so only target-free commands give those providers None.
* style: format the custom sensor test1 parent f757e04 commit c024aea
19 files changed
Lines changed: 314 additions & 54 deletions
File tree
- crates
- sqlbuild-model-config/src/templates
- _helpers
- main
- sqlbuild-python-base/src/event_exporting
- sqlbuild-python-compile/src/compile_driver/main/setup
- sqlbuild-python/src/bindings/_helpers
- build_command
- check
- cli
- native_host
- src/sqlbuild
- .agents/skills/sqlbuild/references/docs/concepts/python-nodes
- tests
- e2e/src/sqlbuild/cli/commands/main/build
- integration/src/sqlbuild/compiler/compiled_project/publication
- website/src/content/docs/docs/concepts/python-nodes
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
383 | | - | |
| 383 | + | |
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| 416 | + | |
416 | 417 | | |
417 | 418 | | |
418 | 419 | | |
| |||
508 | 509 | | |
509 | 510 | | |
510 | 511 | | |
511 | | - | |
| 512 | + | |
512 | 513 | | |
513 | 514 | | |
514 | 515 | | |
| |||
530 | 531 | | |
531 | 532 | | |
532 | 533 | | |
533 | | - | |
| 534 | + | |
534 | 535 | | |
535 | 536 | | |
536 | 537 | | |
| |||
542 | 543 | | |
543 | 544 | | |
544 | 545 | | |
545 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
546 | 550 | | |
547 | 551 | | |
548 | 552 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
| 440 | + | |
448 | 441 | | |
449 | 442 | | |
450 | 443 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | 275 | | |
288 | 276 | | |
289 | 277 | | |
| |||
360 | 348 | | |
361 | 349 | | |
362 | 350 | | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
| 351 | + | |
375 | 352 | | |
376 | 353 | | |
377 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
407 | 408 | | |
408 | 409 | | |
409 | 410 | | |
| 411 | + | |
| 412 | + | |
410 | 413 | | |
411 | 414 | | |
412 | 415 | | |
413 | 416 | | |
414 | | - | |
| 417 | + | |
415 | 418 | | |
416 | 419 | | |
| 420 | + | |
417 | 421 | | |
418 | 422 | | |
419 | 423 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
0 commit comments