-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes config injection edge cases #1430
Merged
Merged
Conversation
This file contains 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
…and literal detection
…ve and merge configs, detect EMPTY incremental on resolve
…rator to resources, rewraps resource on clone to separate sections and incremental instances
… use sentinels to request injected values
✅ Deploy Preview for dlt-hub-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
sh-rp
approved these changes
Jun 5, 2024
This was referenced Jun 13, 2024
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.
Description
This PR fixes two bugs (or unexpected behaviors):
None
is passed todlt.source
,dlt.resource
andwith_config
decorated function that contains arguments with defaults that are notNone
.Code below
when called
open_parquet("file.parquet", None)
will not reset flavour toNone
due to howresolve_config
is implemented. ExplicitNone
is ignored and you getspark
or configured value instead.This PR correct this behavior. Now in the call above
spark
argument evaluates toNone
as you should expect from regular Python call.this is behavior change previously you could use
None
to tell that certain argument should be injected from config. Now the same behavior can be requested viaopen_parquet("file.parquet")
- skipping the default arguments. this is how what we show in our docsopen_parquet("file.parquet", flavour=dlt.config.value)
- explicitly request injection(both worked in old dlt and will work here as well)
@z3z1ma you could be interested in this. if you wrap such decorated function in other functions and use
None
in the outer function signature with the intention to inject value from configuration - this will stop working. We had this issue for example here:(previously None was used as default for
package_repository_branch
)A good example of such undesired behavior is
sql_table
resource insql_database
. When called to get an instance for a particular table with theincremental
argument present, it wraps it in the same instance. With many such resources used in parallel wrong incremental instances may be used.Details of changes
This PR introduces several changes to how configuration is injected
dlt.config.value
anddlt.secrets.value
are implemented as sentinel singletons, there's no need to unparse source code to detect themsql_table
is fixed)