resolving variable / evaluating expression in yaml

1.4k Views Asked by At

I have a YAML file and I want to resolve a variable that is defined using SQL function

report_name: sales_report
report_run_dt: select max(order_date) from orders

When resolved, I want to get the following output

report_name: sales_report
report_run_dt: '2017-01-10'
2

There are 2 best solutions below

0
On

There is no evaluation of any kind of expressions taking place when loading a YAML file. YAML does not know what an SQL server is, nor does it know how to communicate with it, nor is it a tool that generates output from input.

YAML is just data. when you load the YAML data, you get your SQL string select max(order_date) from orders. You can then take it and execute it against some SQL server, but that is clearly outside the scope of YAML.

0
On

i resolved the variable and routed the output to a flat file Using regex, I substituted the value i flat file