Skip to content

Commit

Permalink
Update on credentials.md (#2787)
Browse files Browse the repository at this point in the history
* Update on credentials.md

Updating example code in credentials.md to make it usable when copy/pasting. Since as of now it will generate a TypeError

Signed-off-by: Jose <jmnunezd123@gmail.com>

* adding a more explicit code example, now we directly show the user that project_path is a pathlib.Path object

Signed-off-by: Jose <jmnunezd123@gmail.com>

* Update docs/source/configuration/credentials.md

Co-authored-by: Jo Stichbury <jo_stichbury@mckinsey.com>

---------

Signed-off-by: Jose <jmnunezd123@gmail.com>
Co-authored-by: Jo Stichbury <jo_stichbury@mckinsey.com>
Co-authored-by: Nok Lam Chan <nok.lam.chan@quantumblack.com>
  • Loading branch information
3 people authored Aug 26, 2023
1 parent b3637fb commit 3f87895
Showing 1 changed file with 7 additions and 2 deletions.
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_root>) / settings.CONF_SOURCE)
conf_loader = ConfigLoader(conf_source=conf_path)

try:
Expand Down

0 comments on commit 3f87895

Please sign in to comment.