Make credentials a resolver #4320
Replies: 14 comments 2 replies
-
I like the idea in principle, but what would be a way for us to prevent hardcoding of credentials into the catalog directly? |
Beta Was this translation helpful? Give feedback.
-
Not sure of what you mean : for me the default credentials provided by kedro would do the exact same things as it does now (map a string in the catalog to an entry in credentials.yml) so I don't think there is a problem here. A user who likes playing with kedro's limits could eventually write his own resolver and eventually takes raw inputs directly in the catalog, but I don't think it's kedro's responsibility to try to circumvent all weird things users can do (and funnily, they already can write a custom resolver and use it in the catalog - my proposal would simply enable to make their dangerous logic the default, but they are clearly doing it on purpose). Do you have an example of a situation this proposal would enable which is not already possible and that we want to avoid by all means? |
Beta Was this translation helpful? Give feedback.
-
Hard agree. Our YAML-first approach to credentials is weird, given that there are many other methods that are arguably more prevalent, like environment variables, secrets vaults, JSON token files... Plus we have evidence that users struggle to understand the current approach #1646 (comment) |
Beta Was this translation helpful? Give feedback.
-
I think this is really elegant, I think there is probably a way where this is non-breaking and just an extension too |
Beta Was this translation helpful? Give feedback.
-
@Galileo-Galilei The way
and this:
Currently, the latter will not be taken by Kedro and it won't work, because we do the resolving after loading the config. This way we are preventing users from accidentally checking in secrets. If we go the resolver path (which I like personally), we need to make sure that my second example will error out and your example will only work. |
Beta Was this translation helpful? Give feedback.
-
This is a totally valid concern, I did not think about this edge case. It seems it should be possible to check if the credentials subkey is interpolated with [ |
Beta Was this translation helpful? Give feedback.
-
Originally posted by @MatthiasRoels in #1936 (comment) |
Beta Was this translation helpful? Give feedback.
-
O also think a resolver based way of doing creds would be amazing, I had to hack something together to make things work for my SQLFrame experiement. |
Beta Was this translation helpful? Give feedback.
-
Hi Everyone, As always, a lot of great thoughts & comments. 👍 If I may quickly had some poorly articulated concerns / suggestions that connects this issue to #2829: AWS Secrets bills on READ Our problem is compounded by the fact that, in the Looking very forward to reading your thoughts on this. |
Beta Was this translation helpful? Give feedback.
-
The suggestion make sense. We agree this is something that is useful, at the moment we are doing some re-design for DataCatalog, we will start looking at this once we finish the refactoring. |
Beta Was this translation helpful? Give feedback.
-
More evidence that our users are just using environment variables for credentials https://kedro.hall.community/support-lY6wDVhxGXNY/passing-credentials-to-a-node-in-kedro-DrfL3JQdGpPb (Related to #3979 cc @lordsoffallen) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Credential management in Polars is changing 👀 see
lf = pl.scan_parquet(
"s3://...",
credential_provider=pl.CredentialProviderAWS(profile_name="..."),
) |
Beta Was this translation helpful? Give feedback.
-
Moving this to Discussions to continue the conversation there. |
Beta Was this translation helpful? Give feedback.
-
Description
Make "credentials" a
OmegaConf
resolver, so injecting credentials in the catalog would look like :Context
This may look like a pure technical refactoring, but actually I am expecting this to be an actual improvement for users, e.g. :
settings.py
Overall, this would likely be a general improvement with some overlaps with what is described here #1646 and has never been properly adressed, despite a bunch of discussions around this topic.
Possible Implementation
Move the logic from the catalog and the
_get_credentials
and_resolve_credentials
:kedro/kedro/io/data_catalog.py
Lines 35 to 58 in 7237dc7
kedro/kedro/io/data_catalog.py
Lines 61 to 83 in 7237dc7
to a resolver.
Possible Alternatives
Do nothing and keep the situation as is.
Beta Was this translation helpful? Give feedback.
All reactions