【问题标题】:max bad records in Google bigqueryGoogle bigquery 中的最大不良记录
【发布时间】: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


    【解决方案1】:

    我认为 BQ 确实尊重您的 MAX_BAD_RECORDS,否则您不会看到“错误太多”消息。 “{1}”可能是一个占位符,应该替换为实际限制,但不知何故错过了。

    【讨论】:

      猜你喜欢
      • 2020-04-05
      • 1970-01-01
      • 1970-01-01
      • 2019-05-28
      • 1970-01-01
      • 2021-06-28
      • 2018-07-11
      • 2019-03-15
      • 1970-01-01
      相关资源
      最近更新 更多