[英]HTTP 501 error when trying to use insertAll from Google App Engine to BigQuery
解決:正如Felipe在評論中所建議的那樣,我正在使用EU作為數據位置。 流式傳輸在BigQuery的歐盟數據中心中無法使用,因此我不得不將數據遷移到美國數據中心,之后一切都按預期工作。
我的問題:我正在嘗試使用Google App Engine(python版本)將數據推送到BigQuery。 在實際插入發生之前,一切似乎都很好,之后我收到HTTP 501錯誤。 谷歌的錯誤代碼表將我稱為“聯系支持”。
錯誤回復:
HttpError:https://www.googleapis.com/bigquery/v2/projects/[PROJECT]/datasets/[DATASET]/tables/[TABLE]/insertAll?alt=json返回“未實現:禁用流式傳輸目標數據集。“>
使用的實際代碼:
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所指出的,此功能目前尚未在歐洲數據集上啟用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.