I have the following Python code:
JavaScript
x
23
23
1
def GetData(tableService, tableName, dataFilter):
2
keyMarkers = {}
3
keyMarkers['nextpartitionkey'] = 0
4
keyMarkers['nextrowkey'] = 0
5
b=[]
6
while True:
7
#get a batch of data
8
a = tableService.query_entities(table_name=tableName, filter=dataFilter,num_results=1000 ,marker=keyMarkers)
9
#copy results to list
10
for item in a.items:
11
b.append(item.amount.value)
12
#check to see if more data is available
13
if len(a.next_marker) == 0:
14
del a
15
break
16
#if more data available setup current position
17
keyMarkers['nextpartitionkey'] = a.next_marker['nextpartitionkey']
18
keyMarkers['nextrowkey'] = a.next_marker['nextrowkey']
19
#house keep temp storage
20
del a
21
#return final list
22
return b
23
It is working, however, for the first results, a.items
comes empty. After 10 queries, it finally starts returning some data. It is like the table has no rows for the values I queried. I know it has, and it eventually comes. But only after returning too many empty results.
I have a PHP code for the same purpose, but it doesn’t get empty entities. So I don’t think this is a common behavior from Azure. Maybe the way its SDK for Python works?
Advertisement
Answer
On the very first request, can you try passing in ‘None’ for the marker, rather than a dictionary with 0 and 0 for nextpk / nextrk? I’m not sure, but this might be confusing the service into searching for a table entity with this pk & rk.