【发布时间】:2014-06-14 07:24:15
【问题描述】:
我在 AppEngine 上构建了一个管道,将数据从 Cloud Storage 加载到 BigQuery。这工作正常,..直到有任何错误。如何通过 BigQuery 从我的 AppEngine 代码加载异常?
管道中的代码如下所示:
#Run the job
credentials = AppAssertionCredentials(scope=SCOPE)
http = credentials.authorize(httplib2.Http())
bigquery_service = build("bigquery", "v2", http=http)
jobCollection = bigquery_service.jobs()
result = jobCollection.insert(projectId=PROJECT_ID,
body=build_job_data(table_name, cloud_storage_files))
#Get the status
while (not allDone and not runtime.is_shutting_down()):
try:
job = jobCollection.get(projectId=PROJECT_ID,
jobId=insertResponse).execute()
#Do something with job.get('status')
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
logging.error(traceback.format_exception(exc_type, exc_value, exc_traceback))
time.sleep(30)
这给了我状态错误或重大连接错误,但我正在寻找来自 BigQuery 的功能错误,例如字段格式转换错误、架构结构问题或 BigQuery 在尝试向表中插入行时可能遇到的其他问题。
如果 BigQuery 发生任何“功能性”错误,此代码将成功运行并正常完成,但不会在 BigQuery 上写入任何表。发生这种情况时不容易调试...
【问题讨论】:
标签: google-app-engine google-bigquery google-cloud-storage pipeline