简体   繁体   English

尝试将Google App Engine中的insertAll用于BigQuery时出现HTTP 501错误

[英]HTTP 501 error when trying to use insertAll from Google App Engine to BigQuery

Solved: As Felipe suggested in the comments, I'm using EU as data location. 解决:正如Felipe在评论中所建议的那样,我正在使用EU作为数据位置。 Streaming is not usable in EU data centers for BigQuery and therefore I had to migrate my data to US data centers, after which everything worked as intended. 流式传输在BigQuery的欧盟数据中心中无法使用,因此我不得不将数据迁移到美国数据中心,之后一切都按预期工作。

My question: I'm trying to use Google App Engine (python version) to push data to BigQuery. 我的问题:我正在尝试使用Google App Engine(python版本)将数据推送到BigQuery。 Everything seems fine until the actual insert happens, after which I get a HTTP 501 error. 在实际插入发生之前,一切似乎都很好,之后我收到HTTP 501错误。 Google's error code sheet refers me to "Contact support". 谷歌的错误代码表将我称为“联系支持”。

Error response: 错误回复:
HttpError: https://www.googleapis.com/bigquery/v2/projects/[PROJECT]/datasets/[DATASET]/tables/[TABLE]/insertAll?alt=json returned "Not Implemented: Streaming ingestion is disabled for the destination dataset."> HttpError:https://www.googleapis.com/bigquery/v2/projects/[PROJECT]/datasets/[DATASET]/tables/[TABLE]/insertAll?alt=json返回“未实现:禁用流式传输目标数据集。“>

Actual code used: 使用的实际代码:

class MainHandler(webapp2.RequestHandler):
    def get(self):
        data = json.loads(self.request.get('data'))
        body = {
            'insertId': str(uuid4()),
            'rows':[
                {'json': data}
            ]
        }

        credentials = appengine.AppAssertionCredentials(scope=_SCOPE)
        http = credentials.authorize(httplib2.Http())
        bigquery = discovery.build('bigquery', 'v2', http=http)
        response = bigquery.tabledata().insertAll(
            projectId=PROJECT_ID,
            datasetId=DATASET_ID,
            tableId=TABLE_ID,
            body=body).execute(num_retries=num_retries)

正如Felipe Hoffa所指出的,此功能目前尚未在欧洲数据集上启用。

As the error message suggest: Streaming ingestion is disabled for the destination dataset. 正如错误消息所示:对目标数据集禁用了流式摄取。

You either try to write to a dataset that is listed as public and read only or it's disabled by BigQuery for some reason, and you can contact them. 您要么尝试写入一个列为公共和只读的数据集,要么由于某种原因被BigQuery禁用,您可以联系它们。

You can contact the support here or in case you know it's a known bug, you can try posting an issue here 您可以在此处联系支持人员或者如果您知道这是一个已知错误,可以尝试在此处发布问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM