【发布时间】:2016-05-19 17:15:49
【问题描述】:
当我尝试使用 Google Python Api 客户端将 .csv.gz 文件作为表格从 Google 存储加载到 Bigquery 时出现以下错误:
{u'state': u'DONE', u'errors': [{u'reason': u'invalid', u'message': u'Too many errors encountered. Limit is: {1}.'},
{u'reason': u'invalid', u'message': u'Too many values in row starting at position:64490 in file:/gzip/subrange/gs://my-bucket/myfile.csv.gz'}],
u'errorResult': {u'reason': u'invalid', u'message': u'Too many errors encountered. Limit is: {1}.'}}
我的问题是我在api请求中指定要允许100个错误,使用maxBadRecords参数,如下:
MAX_BAD_RECORDS = 100
body_query = {
'jobReference': {
'projectId': self.project_id,
'jobId': self._job_id
},
'configuration': {
'load': {
'destinationTable': {
'projectId': self.destination_table.project_id,
'datasetId': self.destination_table.dataset.id,
'tableId': self.destination_table.id,
},
'fieldDelimiter': self.delimiter,
'maxBadRecords': MAX_BAD_RECORDS,
'schema': {
'fields': self.schema
},
'sourceUris': self.source_uris,
'skipLeadingRows': self.skip_leading_rows_number,
'writeDisposition': self.write_disposition,
"createDisposition": self.create_disposition,
}
}
}
我认为 Google bigQuery python API 有一个错误,它不认为我的 MAX_BAD_RECORDS 设置为 100。
有人可以帮我吗?
【问题讨论】:
标签: python google-bigquery google-cloud-storage google-api-python-client