Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 Bigquery:作业已完成,但作业。query\u results()。处理的总字节数返回无_Python 2.7_Google Bigquery - Fatal编程技术网

Python 2.7 Bigquery:作业已完成,但作业。query\u results()。处理的总字节数返回无

Python 2.7 Bigquery:作业已完成,但作业。query\u results()。处理的总字节数返回无,python-2.7,google-bigquery,Python 2.7,Google Bigquery,以下代码: import time from google.cloud import bigquery client = bigquery.Client() query = """\ select 3 as x """ dataset = client.dataset('dataset_name') table = dataset.table(name='table_name') job = client.run_async_query('job_name_76', query) job.wri

以下代码:

import time
from google.cloud import bigquery
client = bigquery.Client()
query = """\
select 3 as x
"""
dataset = client.dataset('dataset_name')
table = dataset.table(name='table_name')
job = client.run_async_query('job_name_76', query)
job.write_disposition = 'WRITE_TRUNCATE'
job.destination = table
job.begin()
retry_count = 100
while retry_count > 0 and job.state != 'DONE':
    retry_count -= 1
    time.sleep(10)
    job.reload()
print job.state
print job.query_results().name
print job.query_results().total_bytes_processed
印刷品:

DONE
job_name_76
None
我不明白为什么
total\u bytes\u processed
返回
None
,因为工作已经完成,文档上说:

处理的总字节数:

查询处理的总字节数

返回类型:int或NoneType

返回:在服务器上生成的计数(在服务器设置之前无)


看来你是对的。正如您在中所看到的,当前API不处理有关已处理字节的数据

这已经在本文中报告过了,正如您在本文中看到的,这个特性已经实现,并等待审查/合并,所以我们可能很快就会将此代码投入生产

同时,您可以从
作业
属性
中获得结果,如:

from google.cloud.bigquery import Client
import types
import os

os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'path/to/key.json'

bc = Client()
query = 'your query'
job = bc.run_async_query('name', query)
job.begin()
wait_job(job)

query_results = job._properties['statistics'].get('query')

query\u结果
应该处理您要查找的
totalBytes。

看起来您是对的。正如您在中所看到的,当前API不处理有关已处理字节的数据

这已经在本文中报告过了,正如您在本文中看到的,这个特性已经实现,并等待审查/合并,所以我们可能很快就会将此代码投入生产

同时,您可以从
作业
属性
中获得结果,如:

from google.cloud.bigquery import Client
import types
import os

os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'path/to/key.json'

bc = Client()
query = 'your query'
job = bc.run_async_query('name', query)
job.begin()
wait_job(job)

query_results = job._properties['statistics'].get('query')

query\u结果
应处理您要查找的
totalBytes。

谢谢您的回答。我还发现了
job.\u properties['statistics']['totalBytesProcessed']
给了我结果。谢谢你的回答。我还发现
job.\u properties['statistics']['totalBytesProcessed']
给出了结果。