Jo Stichbury
07/17/2023, 3:41 PMJ. Camilo V. Tieck
07/17/2023, 5:06 PMNok Lam Chan
07/17/2023, 5:16 PM.env
? I am not sure if there are any specific about kedro.J. Camilo V. Tieck
07/17/2023, 8:49 PMfrom kedro.config import TemplatedConfigLoader
CONFIG_LOADER_CLASS = TemplatedConfigLoader
import os
from dotenv import load_dotenv
load_dotenv()
# Keyword arguments to pass to the `CONFIG_LOADER_CLASS` constructor.
CONFIG_LOADER_ARGS = {
"globals_pattern": "*globals.yml", # read the globals dictionary from project config
"globals_dict": os.environ, # read environment variables -> set by .env
}
and then I template the credential file:
estate_valuation_dev_s3bucket:
client_kwargs:
aws_access_key_id: ${AWS_ACCESS_KEY_ID}
aws_secret_access_key: ${AWS_SECRET_ACCESS_KEY}
Jo Stichbury
07/18/2023, 10:32 AMNok Lam Chan
07/18/2023, 10:38 AMglobals_dict
is a common pattern. Even if you are not using .env
file it could be still useful to inject variables. For example:
import os
injected_variables = {}
for key, value in os.environ:
if key.startswith("PROJECT_SPECIFIC_CONFIG"):
injected_variables[key] = value
CONFIG_LOADER_ARGS = {
"globals_pattern": "*globals.yml", # read the globals dictionary from project config
"globals_dict": injected_variables, # read environment variables -> set by .env
}
@J. Camilo V. Tieck. I guess the unclear bit here is that itās not clear where should you put this bit in?
import os
from dotenv import load_dotenv
load_dotenv()
Do we have this documented somewhere? Cc @datajoelydatajoely
07/18/2023, 10:55 AMNok Lam Chan
07/18/2023, 11:00 AMdev_s3:
client_kwargs:
aws_access_key_id: ${oc.env:AWS_ACCESS_KEY_ID}
aws_secret_access_key: ${oc.env:AWS_SECRET_ACCESS_KEY}
https://docs.kedro.org/en/latest/configuration/advanced_configuration.html#how-to-load-credentials-through-environment-variablesChris Schopp
07/18/2023, 1:35 PMfinal_data_set
and working backwards from there. My first pipeline will be to concat data_set1
, data_set2
, ..., to create final_data_set
.
⢠Next I'll wrap my entire existing pipeline in a single node
before gradually refactoring the existing code to use more nodes
and pipelines
.
While I would love to rewrite this project from scratch using Kedro, I'm trying to find the best way to adopt Kedro while retaining existing functionality. How exactly this should be done likely depends on how the original project is structured, but maybe there are some areas that would be common across all projects.Nok Lam Chan
07/18/2023, 1:43 PMJ. Camilo V. Tieck
07/18/2023, 2:00 PMfrom kedro.config import TemplatedConfigLoader
CONFIG_LOADER_CLASS = TemplatedConfigLoader
import os
from dotenv import load_dotenv
load_dotenv()
# Keyword arguments to pass to the `CONFIG_LOADER_CLASS` constructor.
CONFIG_LOADER_ARGS = {
"globals_pattern": "*globals.yml", # read the globals dictionary from project config
"globals_dict": os.environ, # read environment variables -> set by .env
}
Nok Lam Chan
07/18/2023, 2:09 PMenvironment
and thatās where we usually suggest to keep the local credentials.