I am attempting to upload a file from Google's BigQuery Python library (google-cloud-bigquery==1.3.0
)
Using documentation:
dataset_ref = client.dataset(dataset_id)
table_ref = dataset_ref.table(table_id)
job_config = bigquery.LoadJobConfig()
job_config.source_format = bigquery.SourceFormat.CSV
job_config.skip_leading_rows = 1
job_config.autodetect = True
with open(filename, 'rb') as source_file:
job = client.load_table_from_file(
source_file,
table_ref,
location='US',
job_config=job_config)
job.result()
This successfully creates the table and inserts the data, in this case, a simple one-column file of string type.
However, it sets the following column name: string_field_0
.
Is there a way I can customize these column names?