Google bigquery 查询未返回结果时出现的错误

Google bigquery 查询未返回结果时出现的错误,google-bigquery,google-cloud-datalab,Google Bigquery,Google Cloud Datalab,如果有效的BigQuery查询返回0行,to_dataframe()将崩溃。(顺便说一句,我在谷歌云数据实验室上运行这个) 例如: q = bq.Query('SELECT * FROM [isb-cgc:tcga_201510_alpha.Somatic_Mutation_calls] WHERE ( Protein_Change="V600E" ) LIMIT 10') r = q.results() r.to_dataframe() 产生: -----------------------

如果有效的BigQuery查询返回0行,to_dataframe()将崩溃。(顺便说一句,我在谷歌云数据实验室上运行这个)

例如:

q = bq.Query('SELECT * FROM [isb-cgc:tcga_201510_alpha.Somatic_Mutation_calls] WHERE ( Protein_Change="V600E" ) LIMIT 10')
r = q.results()
r.to_dataframe()
产生:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-17-de55245104c0> in <module>()
----> 1 r.to_dataframe()

/usr/local/lib/python2.7/dist-packages/gcp/bigquery/_table.pyc in to_dataframe(self, start_row, max_rows)
    628     # Need to reorder the dataframe to preserve column ordering
    629     ordered_fields = [field.name for field in self.schema]
--> 630     return df[ordered_fields]
    631 
    632   def to_file(self, destination, format='csv', csv_delimiter=',', csv_header=True):

TypeError: 'NoneType' object has no attribute '__getitem__'
---------------------------------------------------------------------------
TypeError回溯(最近一次调用上次)
在()
---->1 r.至_数据帧()
/usr/local/lib/python2.7/dist-packages/gcp/bigquery//u table.pyc in to_数据帧(self、start_行、max_行)
628#需要对数据帧重新排序以保留列顺序
629有序_字段=[self.schema中字段的field.name]
-->630返回df[有序_字段]
631
632 def to_文件(self,destination,format='csv',csv_分隔符=',',csv_头=True):
TypeError:“非类型”对象没有属性“\uuuu getitem\uuuu”

这是一个已知的错误吗?

当然不是一个已知的错误。请记录Felipe提到的bug


欢迎您的贡献,包括bug报告,当然还有修复

请在问题追踪器上查找并报告错误完成:在4d92929中修复(由GrahamW提供)——谢谢!