当我加载到BigQuery数据集时,有没有办法使用Python API从作业中获取错误记录的数量?
答案 0 :(得分:2)
以下是可用于加载作业的统计信息:
statistics.load nested object [Output-only] Statistics for a load job.
statistics.load.inputFileBytes long [Output-only] Number of bytes of source data in a load job.
statistics.load.inputFiles long [Output-only] Number of source files in a load job.
statistics.load.outputBytes long [Output-only] Size of the loaded data in bytes. Note that while a load job is in the running state, this value may change.
statistics.load.outputRows long [Output-only] Number of rows imported in a load job. Note that while an import job is in the running state, this value may change.
如果您知道预期的行数,则可以使用outputRows
找出错误的行数同时 - 您可以控制加载作业中允许的错误记录数量:
configuration.load.allowJaggedRows
configuration.load.ignoreUnknownValues
configuration.load.maxBadRecords
所有这些都可以在中找到 https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.load
和
https://cloud.google.com/bigquery/docs/reference/v2/jobs#statistics.load