https://kedro.org/ logo
#questions
Title
# questions
a

Artur Dobrogowski

06/23/2023, 1:19 PM
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

marrrcin

06/23/2023, 1:59 PM
OmegaConfigLoader is used to load the params, but the
params.yml
cannot be used to interpolate
a

Artur Dobrogowski

06/23/2023, 2:00 PM
only
globals
then?
m

marrrcin

06/23/2023, 2:03 PM
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

Nok Lam Chan

06/23/2023, 2:46 PM
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

Artur Dobrogowski

06/23/2023, 2:47 PM
Thanks!
n

Nok Lam Chan

06/23/2023, 2:50 PM
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

Artur Dobrogowski

06/24/2023, 10:11 AM
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

Nok Lam Chan

06/26/2023, 9:13 AM
That make sense, @Ankita Katiyar do you have idea about this?
a

Ankita Katiyar

06/26/2023, 9:27 AM
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

Artur Dobrogowski

06/26/2023, 9:27 AM
Yay! That's exactly how I wanted it 🙂
(and expected it to work as such)
5 Views