Hi all I have a yaml file: parameters/modules/basi...
# questions
j
Hi all I have a yaml file: parameters/modules/basic.yml
Copy code
general.Basic:
   asset_key: asset_id
Now I want to use value of
asset_key
in other yaml file: parameters/modules/capacity.yml
Copy code
general.Basic:
   capacity_key: ${basic:general.Basic.asset_key}
So I define in settings.py:
Copy code
CONFIG_LOADER_ARGS = {
    "config_patterns": {
        "basic": ["**/basic.yml"],
        "catalog": ["catalog*", "catalog*/**", "../catalog*", "../catalog*/**"],
        "parameters": ["parameters*", "parameters*/**", "**/parameters*"],
        "modules": [
            "parameters/modules*",
            "parameters/modules*/**",
        ],
        "credentials": ["credentials*", "credentials*/**", "**/credentials*"],
        "logging": ["logging*", "logging*/**", "**/logging*"],
    },
}
However, I keep getting an interpolation error. From the docs I have understood that this should be possible, using the approach described above.
n
${basic:general.Basic.asset_key}
This is an incorrect key
Your key is just
${general.Basic.asset_key}
if I understand correctly, or are you using a resolver that is called
basic
that you haven't mentioned above?
Also, I saw you are using the same top-level key
general.Basic
, which I think you will run into this same issue. The PR is merged but we haven't done a release yet. https://kedro-org.slack.com/archives/C03RKP2LW64/p1723193517960259 @Puneet Saini
p
The PR is still up @Nok Lam Chan https://github.com/kedro-org/kedro/pull/4092
πŸ˜… 1
n
you're rightπŸ˜…sorry I have looked at too many PR today
I will be back at this shortly
πŸ™ 1
βœ… 1
thankyou 1
^this is merged now
Thanks a lot for your patience @Puneet Saini
j
Thanks guys!
@Nok Lam Chan
${general.Basic.asset_key}
is not working for me either
n
I don’t understand what are the config_patterns you are using, they are all just parameters right? If so you can remove the basic and module from there.
Can you checkout the link above for full details? Long story short, you cannot use general.Basic as a key and use it for interpolation. You need to define it as a two level key general: Basic: …
j
Yeah, exactly this seems to be the issue, OmegaConfLoader interprets
general.Basic.asset_key
as
Copy code
"general": {
  "Basic": {
      "asset_key: {}
   }
}
πŸ‘πŸΌ 1
So yeah I think I am going it to define the configs as you have suggested, with
Copy code
general:
     Basic:
Well, I just ended up removing the
general.
piece so now root key just becomes
Basic:
and works smoothly, thanks @Nok Lam Chan for the support!
πŸ‘πŸΌ 1