spine-tools / Spine-Database-API

Database interface to Spine generic data model
https://www.tools-for-energy-system-modelling.org/
GNU Lesser General Public License v3.0
6 stars 5 forks source link

fetch_more() may give Traceback after refresh_session() has been called #287

Closed soininen closed 9 months ago

soininen commented 9 months ago

Calling DatabaseMapping.fetch_more() after DatabaseMapping.refresh_session() may raise a Traceback.

  File "spinedb_api\db_mapping.py", line 627, in fetch_more
    return [x.public_item for x in self.do_fetch_more(item_type, limit=limit)]
  File "spinedb_api\db_mapping.py", line 627, in <listcomp>
    return [x.public_item for x in self.do_fetch_more(item_type, limit=limit)]
AttributeError: 'NoneType' object has no attribute 'public_item'

The Traceback originates from _MappedTable.add_item() that may return None if the items are already cached.