BigQuery cacheHit属性 [英] BigQuery cacheHit property

查看:45
本文介绍了BigQuery cacheHit属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using the BigQuery API to run a query with the following code:

query = (
    'SELEC ...'
)

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

results = query_job.result()

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

The query works and outputs expected results. However, I am not able to verify use of the cache.

文档:

如果您使用的是BigQuery API,则查询中的 cacheHit 属性结果设置为true.

If you are using the BigQuery API, the cacheHit property in the query result is set to true.

我正在尝试访问 results.cacheHit ,但确实可行.

I am trying to access results.cacheHit, but it does work out.

AttributeError:"RowIterator"对象没有属性"cacheHit"

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

What am I doing wrong? How can I see the use of cache with my query?

推荐答案

您在文档中使用的引号是指REST API(cacheHit是

The quote you are using from docs refers to the REST API (cacheHit is in the response of the getQueryResults method).

您需要的是 query_job.cache_hit

这篇关于BigQuery cacheHit属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆