Harpal
04/06/2022, 4:18 PMAssetGroup()
allows me to pass in resource_defs
as shown below - but I do not know how to allow users to pass arbitrary values into the “vars” dictionary:
my_job = AssetGroup(
dbt_assets + csv_assets,
resource_defs={
"dbt": dbt_cli_resource.configured(
{
"project_dir": DBT_PROJECT_DIR,
"profiles_dir": DBT_PROFILE_DIR,
"vars": {"test_split": 0.2, "train_split": 0.5},
}
)
},
).build_job()
I am able to run the my_job
in a new script with the my_job.execute_in_process()
method but I would like to pass new values for the train_split
and test_split
variables instead of hard-coding them.
"vars": {"test_split": 0.2, "train_split": 0.5},
How can I pass values to jobs defined by AssetGroup()
’s resource_defs
?claire
04/06/2022, 5:22 PM.configured
on the DBT resource and instead provide the config at job-level. For example:
# run config yaml
resources:
my_dbt_resource:
config:
vars:
test_split: 0.2
train_split: 0.5
...
You could also provide this on the config
argument of the jobHarpal
04/06/2022, 6:00 PMconfig.yaml
file (see below):
#config.yaml
resources:
dbt_cli_resource:
config:
project_dir: "./dbt"
profiles_dir: "./dbt/config"
vars: {"test_split": 0.2, "train_split": 0.5}
I think I understand what you mean by removing the .configured
DBT resource. But I don’t quite understand what you mean by “configure this at the job-level”.
Do I have to pass this config.yaml
file to the AssetGroup()
,build_job()
or my_job.execute_in_process()
methods? Because it’s not clear which one of these would accept such an argument.
Thanks in advance dagsirclaire
04/06/2022, 6:23 PM