hi folks, I'm noticing a difference between `Confi...
# questions
j
hi folks, I'm noticing a difference between
ConfigLoader
and
OmegaConfigLoader
. while following the standalone-datacatalog starter, I notice that
Copy code
ConfigLoader("conf").get("catalog.yml")
works, but
Copy code
OmegaConfigLoader("conf").get("catalog.yml")
returns
None
. on the other hand,
OmegaConfigLoader("conf").get("catalog")
seems to work (notice no
.yml
extension), and
OmegaConfigLoader("conf")["catalog"]
works consistently for both config loaders. is this intentional? compare for example https://github.com/kedro-org/kedro/blob/41f03d9/tests/config/test_config.py#L116 with https://github.com/kedro-org/kedro/blob/41f03d9/tests/config/test_omegaconf_config.py#L149
m
Yes this is intentional.
OmegaConfigLoader
was never meant to be a complete copy of
ConfigLoader
. The
.get("catalog.yml")
way of doing things is old and you should be using the newer way as described here: https://docs.kedro.org/en/stable/configuration/configuration_basics.html#configuration-patterns
j
thanks @Merel! I don't understand how using the
config_patterns
addresses this though - what would be the "new" way of retrieving the catalog config from a
*ConfigLoader
?
Copy code
loader = *ConfigLoader("conf", config_patterns=...)
loader.?
m
Just query it like a dictionary with .get(), but instead of giving it the full file name you give it a key that exists in the config patterns dict. By default that’s:
Copy code
config_patterns = {
    "catalog": ["catalog*", "catalog*/**", "**/catalog*"],
    "parameters": ["parameters*", "parameters*/**", "**/parameters*"],
    "credentials": ["credentials*", "credentials*/**", "**/credentials*"],
    "logging": ["logging*", "logging*/**", "**/logging*"],
}
j
oh I see - so
loader.get
or
loader[]
should receive one of the keys of
config_patterns
, right?
m
yes!
j
thankyou