I'm trying to understand omgeaconfigloader - <http...
# questions
a
I'm trying to understand omgeaconfigloader - https://docs.kedro.org/en/latest/kedro.config.OmegaConfigLoader.html. I know I can use it to interpolate with env variables like this
${oc.env:SOME_VAR}
, but how to use it to interpolate with parameters defined in
params.yml
? let's say I have param
some_var=42
and I want to make it fall back to it when there is no env. Is this correct?
${oc.env:SOME_VAR, ${some_var}}
?
m
OmegaConfigLoader is used to load the params, but the
params.yml
cannot be used to interpolate
a
only
globals
then?
m
I’m not sure whether globals are supported ootb with OmegaConfigLoader.
globals
were
TemplatedConfigLoader
-specific. See: https://github.com/kedro-org/kedro/issues/2407 and https://github.com/kedro-org/kedro/issues/2175
n
oc:env
is only enable for credentials. This is because we don’t want user to abuse environment variable for params. You can still do it after https://github.com/kedro-org/kedro/issues/2622
global
is still an open ticket https://github.com/kedro-org/kedro/issues/2175
a
Thanks!
n
let’s say I have param
some_var=42
and I want to make it fall back to it when there is no env. Is this correct?
Can you elaborate what are you trying to specifically? Often you may want to use the
base
local
pattern for this purpose rather than injecting environment variable.
a
I wanted a config that takes parameters that are defined in params config file and those can be overriden with environment variables when set. It's important that those are envs as the pipeline will work in CICD and that's the easiest way to pass arguments there.
👍🏼 1
n
That make sense, @Ankita Katiyar do you have idea about this?
a
Once this ticket is merged in, you should be able to activate
oc.env
from your
settings.py
and do it like this -
${oc.env:SOME_VAR, ${some_var}}
a
Yay! That's exactly how I wanted it 🙂
(and expected it to work as such)