Hello,
I am trying to simply iterate through a subspace items and read them as Key-Value pair.
I have created a directory and a subspace for it that holds all the relevant information about my data structure.
I have already populated, and I am trying to simply iterate through it using Transaction.get_range(start, end) in Python.
Here is a snippet of my getItems() code:
@fdb.transactional
def GETItems(self, tr, subspace):
range = subspace.range()
start = range.start
stop = range.stop
for packedKey, packedValue in tr.get_range(start, stop):
key = subspace.unpack(packedKey)
valueTup = fdb.tuple.unpack(packedValue)
yield ((key, valueTup,))
I get the following trace at execution:
main()
line 61, in main
for item in storeConnector.getItems(subspaceName):
StoreConnectorClasses.py", line 188, in GETItems
for packedKey, packedValue in tr.get_range(start, stop):
/fdb/impl.py", line 372, in iter
(kvs, count, more) = future.wait()
/fdb/impl.py", line 691, in wait
self.capi.fdb_future_get_keyvalue_array(self.fpointer, ctypes.byref(kvs), ctypes.byref(count), ctypes.byref(more))
/fdb/impl.py", line 1204, in check_error_code
raise FDBError(code)
fdb.impl.FDBError: b’Operation issued while a commit was outstanding’ (2017)
If I don’t use a transaction and use a database object, this doesn’t happen. I am very puzzled about this error.
What would be the most efficient way to iterate over a subspace as an iterator?
Many thanks in advance!