Hello Andre!
Unfortunately, the BigQuerySource does not support value providers.
There is a different transform to read from bigquery in
apache_beam.io.gcp.bigquery._ReadFromBigQuery. This one will soon support
it (hopefully by 2.21).
Unfortunately at the moment, it is not possible to change the query
depending on the value providers.
Best
-P.

On Fri, Mar 13, 2020 at 12:46 PM André Rocha Silva <
[email protected]> wrote:

> Hello everybody
>
> I have a query that I am trying to use in dataflow:
>
> ***
>  'QueryTable' >> beam.io.Read(
>     beam.io.BigQuerySource(
>         dataset='dataset',
>         project='project',
>         query=f''' SELECT * FROM dataset.table WHERE version =
> '{user_options.version}'''' )
> ***
> When I run it from my terminal with Dataflow runner, it goes as it should
> be. No problem at all.
>
> But when I try to launch it from template the query does not get the
> option. That appears in the step info.
>
> [image: image.png]
>
> I have tried to change from {user_options.version}
> to {user_options.version.get()}. But got this error:
> apache_beam.error.RuntimeValueProviderError: RuntimeValueProvider(option:
> version, type: str, default_value: None).get() not called from a runtime
> context
>
> Does someone know how to correct this?
> Locally, I am using:
> SDK version
> Apache Beam Python 3.7 SDK 2.17.0
>
> Thank you a lot!
>
> --
>
>    *ANDRÉ ROCHA SILVA*
>   * DATA ENGINEER*
>   (48) 3181-0611
>
>   <https://www.linkedin.com/in/andre-rocha-silva/> /andre-rocha-silva/
> <http://portaltelemedicina.com.br/>
> <https://www.youtube.com/channel/UC0KH36-OXHFIKjlRY2GyAtQ>
> <https://pt-br.facebook.com/PortalTelemedicina/>
> <https://www.linkedin.com/company/9426084/>
>
>

Reply via email to