Skip to main content
 首页 » 编程设计

Python之如何在 Azure 表存储中进行范围查询

2025年05月04日14powertoolsteam

我一直在尝试寻找正确的语法来创建从 Python 到 Azure 表存储表的范围查询。

continuation token 对我没有帮助,因为我想定义一个特定的范围或 RowKeys 并只检索那些。

我一直在尝试以下

rows = table_service.query_entities( 
    tableName, 
    "PartitionKey eq '6' and RowKey gt '1452702466022' and RowKey lt '1452702466422") 

和

rows = table_service.query_entities( 
    'rawpowervalues6', "PartitionKey eq '6'", 
    select="RowKey gt '1452702466022' and RowKey lt '1452702466422") 

运气不好。我找不到任何关于 python 范围查询的官方文档。迄今为止最好的资源是 that但我不能让它在 python 中工作。

请您参考如下方法:

在您的第一个查询中,您缺少结尾引号:'。您可能想尝试:

rows = table_service.query_entities( \ 
    tableName, \ 
    "((PartitionKey eq '6' and RowKey gt '1452702466022') and RowKey lt '1452702466422')")