简体   繁体   English

AttributeError:“客户端”对象没有属性“查询”

[英]AttributeError: 'Client' object has no attribute 'query'

I try to implement bigquery in python 2.7 on jupyter notebook. 我尝试在jupyter笔记本上的python 2.7中实现bigquery。 I think my code is correct, but i'm getting the error "AttributeError: 'Client' object has no attribute 'query'" 我认为我的代码是正确的,但出现错误“ AttributeError:'客户端'对象没有属性'查询'”

# Create SQL query using natality data after the year 2000
query = """
SELECT
  weight_pounds,
  is_male,
  mother_age,
  plurality,
  gestation_weeks,
  ABS(FARM_FINGERPRINT(CONCAT(CAST(YEAR AS STRING), CAST(month AS STRING)))) AS hashmonth
FROM
  publicdata.samples.natality
WHERE year > 2000
"""

# Call BigQuery and examine in dataframe
from google.cloud import bigquery
client = bigquery.Client()
df = client.query(query + " LIMIT 100").to_dataframe()
df.head()

The error message i got is: 我收到的错误消息是:

AttributeErrorTraceback (most recent call last)
<ipython-input-12-caf57b3f137d> in <module>()
      2 from google.cloud import bigquery
      3 client = bigquery.Client()
----> 4 df = client.query(query + " LIMIT 100").to_dataframe()
      5 df.head()

AttributeError: 'Client' object has no attribute 'query'

Problem fixed! 问题已解决! Just need to update the bigquery via pip install --upgrade google-cloud-bigquery 只需要通过pip install --upgrade google-cloud-bigquery更新pip install --upgrade google-cloud-bigquery

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

相关问题 AttributeError: 对象没有属性“tk” - AttributeError: object has no attribute 'tk' AttributeError:“模块”对象没有属性 - AttributeError: 'module' object has no attribute AttributeError:UnionC 对象没有属性 - AttributeError: UnionC object has no attribute AttributeError: 'tuple' object 没有属性 - AttributeError: 'tuple' object has no attribute 如何修复AttributeError:在Google Cloud Interactive Shell中运行python时,'module'对象没有属性'Client' - How to fix AttributeError: 'module' object has no attribute 'Client' when running python in Google Cloud Interactive Shell 虽然气流initdb,但AttributeError:module&#39;对象没有属性&#39;client_auth&#39; - While airflow initdb, AttributeError: module' object has no attribute 'client_auth' plotly-AttributeError:“模块”对象没有属性“工具” - plotly - AttributeError: 'module' object has no attribute 'tools' AttributeError:“ Mininet”对象没有属性“ addBaseStation” - AttributeError: 'Mininet' object has no attribute 'addBaseStation' AttributeError:“事件”对象没有属性“获取” - AttributeError: 'Event' object has no attribute 'get' AttributeError:&#39;tuple&#39;对象没有属性&#39;shape&#39; - AttributeError: 'tuple' object has no attribute 'shape'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM