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

Let*_*zee 1 python azure azure-table-storage

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

延续令牌无法帮助我,因为我想定义特定范围或 RowKeys 并仅检索那些。

我一直在尝试以下

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

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

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

min*_*han 5

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

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