异步insertAll请求使用python-api-client

时间:2014-11-24 13:40:41

标签: python google-app-engine google-bigquery

我使用以下代码将数据从App Engine流式传输到BigQuery。目前请求正在阻止。有没有办法使用apiclient(不使用deferred库或类似的)使这些请求异步?

credentials = AppAssertionCredentials(scope = 'https://www.googleapis.com/auth/bigquery')
http = credentials.authorize(httplib2.Http())
bigquery = build('bigquery', 'v2', http = http)
bigquery.tabledata().insertAll(
    projectId = PROJECT_NUMBER,
    datasetId = DATASET_ID,
    tableId = TABLE_ID,
    body = body).execute()

1 个答案:

答案 0 :(得分:1)

Python api客户端(来自https://developers.google.com/api-client-library/python/)是一个同步客户端。您必须在客户端之外管理异步请求。