Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update on credentials.md #2787

Merged
merged 12 commits into from
Aug 26, 2023
9 changes: 7 additions & 2 deletions docs/source/configuration/credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ Credentials configuration can be loaded the same way as any other project config
The following examples all use the default `ConfigLoader` class.

```python
from pathlib import Path

from kedro.config import ConfigLoader
from kedro.framework.project import settings

conf_path = str(project_path / settings.CONF_SOURCE)
# Substitute <project_root> with the [root folder for your project](https://docs.kedro.org/en/stable/tutorial/spaceflights_tutorial.html#terminology)
conf_path = str(Path(<project_root>) / settings.CONF_SOURCE)
conf_loader = ConfigLoader(conf_source=conf_path)
credentials = conf_loader["credentials"]
```
Expand All @@ -25,10 +28,12 @@ This loads configuration files from `conf/base` and `conf/local` whose filenames
Calling `conf_loader[key]` in the example above throws a `MissingConfigException` error if no configuration files match the given key. But if this is a valid workflow for your application, you can handle it as follows:

```python
from pathlib import Path

from kedro.config import ConfigLoader, MissingConfigException
from kedro.framework.project import settings

conf_path = str(project_path / settings.CONF_SOURCE)
conf_path = str(Path(project_path) / settings.CONF_SOURCE)
conf_loader = ConfigLoader(conf_source=conf_path)

try:
Expand Down