I tried insert to bigquery with schema:
require 'gcloud'
gc = Gcloud.new 'PROJECT_ID'
bq = gc.bigquery
ds = bq.dataset 'MY_DATASET'
t = ds.create_table 'MY_TABLE'
t.schema = { fields: [ { name: 'Name', type: 'STRING' } ] }
t.insert [{'name' => 'test1'}]
As expected, my terminal console showed the output error:
[{"reason"=>"invalid", "location"=>"name", "debugInfo"=>"generic::not_found: no such field.", "message"=>"no such field."}]
When I tried to update schema to insert the key Name:
t.schema = {
fields: [
{ name: 'Name', type: 'STRING' },
{ name: 'name', type: 'STRING' }
]
}
Displayed the exception:
Gcloud::Bigquery::ApiError: Field name already exists in schema
Any suggestion how can I solve this? This is a BigQuery bug?
nametwice, despite uppercasing the field name the first time. - Justin WoodNameand I can't create a lowecase key after a defined schema with a uppercase letter in the key. I can't insert data with lowercase key also. It's pretty confusing. - Victor Lellis