简体   繁体   English

是否有更有效的方式与来自 azure-data.tables SDK function query_entities 的 ItemPaged 对象进行交互?

[英]Is there a more efficient way to interact with ItemPaged objects from azure-data-tables SDK function query_entities?

The quickest method I have found is to just convert the ItemPaged object to a list using list() and then I'm able to manipulate/extract using a Pandas DataFrame. However, if I have millions of results, the process can be quite time-consuming, especially if I only want every nth result over a certain time-frame, for instance.我发现最快的方法是使用 list() 将 ItemPaged object 转换为列表,然后我可以使用 Pandas DataFrame 进行操作/提取。但是,如果我有数百万个结果,这个过程可能会很长- 消耗,特别是如果我只想要特定时间范围内的每第 n 个结果,例如。 Typically, I would have to query the entire time-frame and then re-loop to only obtain every nth element.通常,我必须查询整个时间范围,然后重新循环以仅获取每个第 n 个元素。 Does anyone know a more efficient way to use query_entities OR how to more efficiently return every nth item from ItemPaged or more explicitly from table.query_entities?有谁知道使用 query_entities 的更有效方法或如何更有效地从 ItemPaged 或更明确地从 table.query_entities 返回每第 n 个项目? Portion of my code below:我的代码部分如下:

connection_string = "connection string here"
service = TableServiceClient.from_connection_string(conn_str=connection_string)
table_string = ""
table = service.get_table_client(table_string)
entities = table.query_entities(filter, select, etc.)
results = pd.DataFrame(list(entities))

Does anyone know a more efficient way to use query_entities OR how to more efficiently return every nth item from ItemPaged or more explicitly from table.query_entities?有谁知道使用 query_entities 的更有效方法或如何更有效地从 ItemPaged 或更明确地从 table.query_entities 返回每第 n 个项目?

After reproducing from my end, one of the ways to achieve your requirement using get_entity() instead of query_entities() .从我这边复制后,使用get_entity()而不是query_entities() ) 来实现您的要求的方法之一。 Below is the complete code that worked for me.以下是对我有用的完整代码。

entity = tableClient.get_entity(partition_key='<PARTITION_KEY>', row_key='<ROW_KEY>')
print("Results using get_entity :")
print(format(entity))

RESULTS:结果:

在此处输入图像描述

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

相关问题 有没有办法让这个 SQL 查询更有效率? - Is there a way to make this SQL query more efficient? Azure.Data.Tables C# SDK 查询时间戳返回零结果 - Azure.Data.Tables C# SDK query Timestamp returning zero results 在 Azure 表存储中跨实体查询的最佳方式 - Best way to query across entities in Azure Table Storage Google App Engine DataStore - 如何以有效的方式从 Java 中子表的键中获取 select 父实体? - Google App Engine DataStore - How to select parent entities from keys of a child table in Java in an efficient way? 从 Big Query 数据集中的所有表中获取特定列数据 - Get specific column data from all tables in Big Query datasets 在不同分组中获得汇总结果的更有效方法? - SQL - More efficient way to get aggregate results in different groupings? - SQL Azure 数据表 JS SDK - 如何设置请求 Header - contentType: application/json;odata=nometadata - Azure Data Tables JS SDK - how to set Request Header - contentType: application/json;odata=nometadata 将查询从 Azure Data Explorer 导入到 PowerBI - import query from Azure Data Explorer to PowerBI 无法从 NodeJS 中的 Azure httpTriggered Function 获取响应数据 - Can not get the data in response from Azure httpTriggered Function in NodeJS 从另一个 Azure Function 呼叫 Azure Function - Calling Azure Function from another Azure Function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM