Reputation: 1465
Is it possible to specify comments in the schema definition of a BigQuery table via the API?
I use the following schema when creating a BigQuery table via the Hadoop connector
[{"name" : "event_id", "type" : "integer"},{ "name" : "categorization" , "type" : "string" }]
And I want something like
[{"name" : "event_id", "type" : "integer", "description" : "The event identifier"},{ "name" : "categorization" , "type" : "string" }]
EDIT: I've just tried this with the spark connector but it doesn't work. The descriptions are still empty
BigQueryConfiguration.configureBigQueryOutput(
bqConfiguration, projectId, bqDatasetId, bqTable, schema)
bqConfiguration.set(
"mapreduce.job.outputformat.class",
classOf[BigQueryOutputFormat[_,_]].getName)
new JavaPairRDD(rdd.map((null, _))).saveAsNewAPIHadoopDataset(bqConfiguration)
}
DOUBLE EDIT: Added some code for context
Upvotes: 1
Views: 3508
Reputation: 172944
That is exactly what BigQuery provides you with
You can do this either upon table creation with Tables: insert API or you can add to existing table using Tables: patch API
See respective parameters to be used in Table Resources
You can have description for whole table and for each field
Upvotes: 1
Reputation: 3251
Yes, table fields can have their own descriptions. The schema you posted with the description should work when sent to the API.
https://cloud.google.com/bigquery/docs/reference/v2/tables#schema.fields.description
Upvotes: 0