2
votes

Am using DataFlow 2.0/Apache Beam as the framework to read data from BigQuery and write to a SQL database. Would like to read the schema definition from BigQuery and then create an equivalent table in the SQL definition.

What is the Java API to get the BigQuery schema definition?

The docs only talk about reading the data but not the metadata.

Thanks -ravi

1

1 Answers

3
votes

You can use the BigQuery Java client library. The schema of a table can be accessed via bigQuery.getTable(datasetId, tableId).getDefinition().getSchema().