Skip to content Skip to sidebar Skip to footer

Apache Beam Write To Bigquery Table And Schema As Params

I'm using Python SDK for Apache Beam. The values of the datatable and the schema are in the PCollection. This is the message I read from the PubSub: {'DEVICE':'rms005_m1','DATESTAM

Solution 1:

You have to pass a function into table. Try this, instead:

| "Write to BQ" >> beam.io.WriteToBigQuery(
            table=lambda element: 'project:dataset{datatable}__opdata'.format(datatable = element["DEVICE"]),
            schema=set_schema,
            write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND
        )

Post a Comment for "Apache Beam Write To Bigquery Table And Schema As Params"