【问题标题】:BigQuery cacheHit propertyBigQuery cacheHit 属性
【发布时间】:2018-08-03 08:19:34
【问题描述】:

我正在使用 BigQuery API 使用以下代码运行查询:

query = (
    'SELEC ...'
)

# API request - starts the query
query_job = client.query(
    query,
    location='US'
)

results = query_job.result()

查询有效并输出预期结果。 但是,我无法验证缓存的使用。

Docs

如果您使用 BigQuery API,查询中的 cacheHit 属性 结果设置为真。

我正在尝试访问 results.cacheHit,但它确实成功了。

AttributeError: 'RowIterator' object has no attribute 'cacheHit'

我做错了什么?如何在查询中查看缓存的使用情况?

【问题讨论】:

    标签: google-bigquery


    【解决方案1】:

    您在 docs 中使用的引用是指 REST API(cacheHit 在 getQueryResults 方法的响应中)。

    你需要的是query_job.cache_hit

    【讨论】:

      猜你喜欢
      • 2019-11-30
      • 2012-07-08
      • 2015-03-04
      • 1970-01-01
      • 2021-10-22
      • 1970-01-01
      • 2022-10-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多