Afiq Johari
03/05/2025, 10:33 AMSQLQueryDataset
table_output:
type: pandas.SQLQueryDataset
sql: >
select * from dev.output
I also have parameters.yml
mode: 'ABC'
The expectation now is to update table_output
to filter itself based on parameter mode
If I use the following hard coded load_args method, the table_output
will be filtered based on the 'ABC'
params
table_output:
type: pandas.SQLQueryDataset
sql: >
select * from dev.output
where mode = ?
load_args:
params:
- 'ABC'
How can I reuse the parameters defined in parameters.yml
as part of the table_output
definition?
Something like
table_output:
type: pandas.SQLQueryDataset
sql: >
select * from dev.output
where mode = ?
load_args:
params:
- ${parameters.mode} # to reference parameters in parameters.yml?
Hall
03/05/2025, 10:33 AMAnkita Katiyar
03/05/2025, 10:43 AMAfiq Johari
03/05/2025, 11:19 AMNok Lam Chan
03/05/2025, 3:01 PMparameters.yml
are meant to be node argument, something that get passed into your node function. Where the parameters.mode
here are acting more like a template variable.
You could also move this mode
to catalog.yml
table_output:
type: pandas.SQLQueryDataset
sql: >
select * from dev.output
where mode = ${_mode}
load_args:
params:
- ${_mode} # to reference parameters in parameters.yml?
_mode: "some_mode"
``````
For things that are absolutely global (needed for catalog/parameters and other stuff), then you should use globals
(the anti-pattern here is use globals.yml
for everything)minmin
03/07/2025, 10:53 AM{mycountry}.table_output:
type: pandas.SQLQueryDataset
sql: >
select * from mytable.output
where country = ${mycountry}
load_args:
params:
- ${{mycountry}.name}
Nok Lam Chan
03/07/2025, 12:14 PMNok Lam Chan
03/07/2025, 12:14 PMminmin
03/07/2025, 3:42 PMFrance:
short_name: FR
minmin
03/07/2025, 3:42 PM