It sounds like you want to know how to use function query_entities(table_name, filter=None, select=None, num_results=None, marker=None, accept='application/json;odata=minimalmetadata', property_resolver=None, timeout=None)
as the figure below to list the latest entites of the table table1
with SCHEDULE
RowKey value.

As I known, you need to realize it with the filter
parameter, as the code below.
filter = "RowKey eq 'SCHEDULE'
task2 = table_service.query_entities('table1', filter=filter)
print(list(task2))
The code above will list all entites with RowKey
SCHEDULE
and unknown PartitionKey
, please refer to the offical document Querying Tables and Entities
to know more details for using the filter
parameter.
However, due to there is not support for sorting the entities by Timestamp
, you can not get the latest entity directly by filter
and num_results=1
. If there is a pattern to know the timestamp range of the latest entities, you can try to use the code below.
import datetime
from operator import itemgetter
filter = "RowKey eq 'SCHEDULE' and Timestamp lt datetime'{}'".format(datetime.datetime.utcnow().isoformat()) # such as `2019-07-29T07:41:40.897643`
# Or filter = "RowKey eq 'SCHEDULE' and Timestamp ge datetime'<the start of datetime range>' and Timestamp lt datetime'<the end of datetime range>'"
task2 = table_service.query_entities('table1', filter=filter)
print(list(task2))
newlist = sorted(task2, key=itemgetter('Timestamp'))
latest_entity = newlist[0]
print(latest_entity)
If you want a simple solution, I think Azure Function with Table Storage trigger will helps, please refer to the offical document Azure Table storage bindings for Azure Functions
which supports Python.
Hope it helps.