Closed jkiviluo closed 7 months ago
v0.8.
You need a db with alternative 'init', entity_class 'node' and an entity with a name 'CH4'.
Add CH4 to init alternative.
Connect to the DB in Python console.
Then trying first: foo = db_generic.get_entity_alternative_item(alternative_name="init", entity_class_name="node", entity_byname=("CH4",))
foo = db_generic.get_entity_alternative_item(alternative_name="init", entity_class_name="node", entity_byname=("CH4",))
This works.
Then trying (...items instead of item):
foo = db_generic.get_entity_alternative_items(entity_class_name="node", entity_byname=("CH4",))
And this fails with:
Traceback (most recent call last): File "C:\Users\prokjt\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\util\_collections.py", line 210, in __getattr__ return self._data[key] KeyError: 'entity_class_id' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\prokjt\Miniconda3\envs\spi-entity\lib\site-packages\IPython\core\interactiveshell.py", line 3526, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-4-57cfcbdd22d9>", line 1, in <module> foo = db_generic.get_entity_alternative_items(entity_class_name="node", entity_byname=("CH4",)) File "C:\data\spi-entity\Spine-Toolbox\src\spinedb-api\spinedb_api\db_mapping.py", line 377, in get_items self.do_fetch_all(item_type, **kwargs) File "C:\data\spi-entity\Spine-Toolbox\src\spinedb-api\spinedb_api\db_mapping_base.py", line 284, in do_fetch_all self.do_fetch_more(item_type, offset=0, limit=None, **kwargs) File "C:\data\spi-entity\Spine-Toolbox\src\spinedb-api\spinedb_api\db_mapping_base.py", line 265, in do_fetch_more chunk = self._get_next_chunk(item_type, offset, limit, **kwargs) File "C:\data\spi-entity\Spine-Toolbox\src\spinedb-api\spinedb_api\db_mapping_base.py", line 249, in _get_next_chunk qry = self._make_query(item_type, **kwargs) File "C:\data\spi-entity\Spine-Toolbox\src\spinedb-api\spinedb_api\db_mapping_base.py", line 108, in _make_query qry = qry.filter(getattr(sq.c, src_key) == getattr(ref_sq.c, ref_key), getattr(ref_sq.c, key) == value) File "C:\Users\prokjt\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\util\_collections.py", line 212, in __getattr__ raise AttributeError(key) AttributeError: entity_class_id
v0.8.
You need a db with alternative 'init', entity_class 'node' and an entity with a name 'CH4'.
Add CH4 to init alternative.
Connect to the DB in Python console.
Then trying first:
foo = db_generic.get_entity_alternative_item(alternative_name="init", entity_class_name="node", entity_byname=("CH4",))
This works.
Then trying (...items instead of item):
foo = db_generic.get_entity_alternative_items(entity_class_name="node", entity_byname=("CH4",))
And this fails with: