Repository navigation
fix: give Python node results and provider setup the selected target - #1529
Merged
Merged
Conversation
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.
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.
…text # Conflicts: # crates/sqlbuild-python-compile/src/compile_driver/_helpers/setup/targets.rs # crates/sqlbuild-python/src/bindings/_helpers/build_command/lifecycle.rs # crates/sqlbuild-python/src/bindings/_helpers/check/check_command.rs
…olved 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.
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.
…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.
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 17, 2026
…text # Conflicts: # fensu.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A target schema such as
s_${CTX:model.name}resolves only inside a model.sqb buildgave Python nodes the raw template as their default schema, so saving a node result ranCREATE SCHEMA IF NOT EXISTS s_${CTX:model.name}and failed.Providers used by event exporters and command output sinks were set up with
ctx=None. Build, check and load reuse that session, so their nodes' providers lost the target too, as did custom sensors' providers.Changes
${CTX:...}placeholder.--target,--vars, else the default target) insetup(ctx). Resolving them keeps JSON stdout clean.sqb formatstill run withctx=None. No other target is substituted.ctx=None.ctxisNone.sqlbuild-pythoncap is set to its exact count, 66,878 (+47).DuckShop: no edge case added. The bug needs a target-wide
${CTX:...}schema, which changes every model rather than one isolated case; the DuckDB E2E test covers it.Verification
format --checkgetsctx=None.setupgets the evaluation target.fensu checkandfensu dupes --since origin/mainare clean.make check-cipasses on the final head.