Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB editor doesn't load entities when opened #2311

Closed
PiispaH opened this issue Sep 14, 2023 · 1 comment
Closed

DB editor doesn't load entities when opened #2311

PiispaH opened this issue Sep 14, 2023 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@PiispaH
Copy link
Collaborator

PiispaH commented Sep 14, 2023

Sometimes when opening Toolbox and then opening db editor for a db that has entities and parameter values in it, the entities don't load into the editor but the parameter values do.

image

Traceback (most recent call last):
  File "C:\toolbox\lib\site-packages\sqlalchemy\util\_collections.py", line 210, in __getattr__
    return self._data[key]
KeyError: 'commit_id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\spine-toolbox\spinetoolbox\helpers.py", line 122, in new_function
    return func(*args, **kwargs)
  File "C:\spine-toolbox\spinetoolbox\fetch_parent.py", line 93, in _apply_pending_changes
    self.handle_items_added({db_map: data})
  File "C:\spine-toolbox\spinetoolbox\fetch_parent.py", line 292, in handle_items_added
    self._handle_items_added(db_map_data)
  File "C:\spine-toolbox\spinetoolbox\spine_db_editor\mvcmodels\multi_db_tree_item.py", line 294, in handle_items_added
    self.append_children_by_id(db_map_ids)
  File "C:\spine-toolbox\spinetoolbox\spine_db_editor\mvcmodels\multi_db_tree_item.py", line 314, in append_children_by_id
    self._merge_children(new_children)
  File "C:\spine-toolbox\spinetoolbox\spine_db_editor\mvcmodels\multi_db_tree_item.py", line 254, in _merge_children
    self._insert_children_sorted(unmerged)
  File "C:\spine-toolbox\spinetoolbox\spine_db_editor\mvcmodels\multi_db_tree_item.py", line 260, in _insert_children_sorted
    self.insert_children(pos, chunk)
  File "C:\spine-toolbox\spinetoolbox\spine_db_editor\mvcmodels\multi_db_tree_item.py", line 400, in insert_children
    if not super().insert_children(position, children):
  File "C:\spine-toolbox\spinetoolbox\mvcmodels\minimal_tree_model.py", line 161, in insert_children
    self._polish_children(children)
  File "C:\spine-toolbox\spinetoolbox\spine_db_editor\mvcmodels\entity_tree_item.py", line 75, in _polish_children
    db_map_entity_class_ids = {
  File "C:\spine-toolbox\spinetoolbox\spine_db_editor\mvcmodels\entity_tree_item.py", line 76, in <dictcomp>
    db_map: {x["class_id"] for x in self.db_mngr.get_items(db_map, "entity", only_visible=False)}
  File "C:\spine-toolbox\spinetoolbox\spine_db_manager.py", line 636, in get_items
    db_map.cache.fetch_all(item_type)
  File "C:\toolbox\src\spinedb-api\spinedb_api\db_cache_base.py", line 218, in fetch_all
    while self.fetch_more(item_type):
  File "C:\toolbox\src\spinedb-api\spinedb_api\db_cache_base.py", line 215, in fetch_more
    return bool(self.advance_query(item_type))
  File "C:\toolbox\src\spinedb-api\spinedb_api\db_cache_base.py", line 193, in advance_query
    chunk = self._get_next_chunk(item_type)
  File "C:\toolbox\src\spinedb-api\spinedb_api\db_cache_base.py", line 171, in _get_next_chunk
    qry = self._query(item_type)
  File "C:\toolbox\src\spinedb-api\spinedb_api\db_cache_impl.py", line 76, in _query
    return self._db_map.query(getattr(self._db_map, sq_name))
  File "C:\toolbox\src\spinedb-api\spinedb_api\db_mapping_base.py", line 562, in wide_entity_sq
    ext_entity_sq.c.commit_id,
  File "C:\toolbox\lib\site-packages\sqlalchemy\util\_collections.py", line 212, in __getattr__
    raise AttributeError(key)
AttributeError: commit_id
@PiispaH PiispaH added bug Something isn't working 0.8-dev labels Sep 14, 2023
@PiispaH PiispaH added this to the v0.8.0 milestone Sep 14, 2023
@PiispaH
Copy link
Collaborator Author

PiispaH commented Nov 3, 2023

Can't seem to reproduce anymore with other databases.

@PiispaH PiispaH closed this as not planned Won't fix, can't repro, duplicate, stale Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant