Open
Conversation
Contributor
Additional Artifact Review RequiredChanges to artifact directory files requires at least 2 approvals from core team members. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12545 +/- ##
==========================================
- Coverage 91.45% 91.37% -0.09%
==========================================
Files 203 203
Lines 25471 25551 +80
==========================================
+ Hits 23294 23346 +52
- Misses 2177 2205 +28
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
4 tasks
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.
Resolves #9775
Problem
The
sql_headerconfig is not supported for data tests (singular and generic). When users configuresql_header— either via theset_sql_headermacro in singular tests or via YAMLconfig:in generic tests — the value is silently dropped during parsing because:TestConfighas nosql_headerfield, so any value set during parsing is discarded during serialization.TestBuilder.CONFIG_ARGSdoes not includesql_header, so generic tests don't recognize it as a config key from YAML and it gets treated as a test argument instead.This prevents users from prepending SQL statements before test execution — a capability that already works for models.
Solution
Add
sql_headeras a recognized config field for data tests:sql_header: Optional[str] = NonetoTestConfigdataclass and include it in thesame_contentsmodifiers list for partial parsing support."sql_header"toTestBuilder.CONFIG_ARGSso generic tests acceptsql_headerin their YAML config block.Note: A companion PR in dbt-adapters is needed to actually prepend the
sql_headerin the test and unit test materialization macros (test.sqlandunit.sql). Without that change, the config value is correctly parsed and stored but not applied during execution.Checklist