Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Dataflow: create templates with runtime parameters

In Data flow, I need to pass start Date and end date as runtime arguments and query bigquery for that date range and write output to day wise folders.

When we use ValueProvider, getStartDate().get() method is throwing java.lang.RuntimeException: Not called from a runtime context. If I hardcode some value when getStartDate().get().isAccessible() is false, template is being generated but the runtime arguments are not reflecting in job. It is always running with the hardcoded value during template creation.

Any suggestions ?

like image 499
rhg Avatar asked Jan 20 '26 12:01

rhg


1 Answers

BigQueryIO takes a ValueProvider of the query. The easiest way to do this is to pass the query text as the runtime value.

NestedValueProvider could help you create the query string from another value provider, alas, NestedValueProvider only support one input ValueProvider at a time. So you could concatenate your start and end dates into a single value and then do the split.

like image 62
rf- Avatar answered Jan 23 '26 11:01

rf-



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!