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 does not add new classes if they are empty #2312

Closed
jkiviluo opened this issue Sep 14, 2023 · 8 comments
Closed

DB editor does not add new classes if they are empty #2312

jkiviluo opened this issue Sep 14, 2023 · 8 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jkiviluo
Copy link
Member

Commit will not add new empty (multi-dimensional?) classes. Apparently there needs to be some data there.

@jkiviluo jkiviluo added the bug Something isn't working label Sep 14, 2023
@jkiviluo jkiviluo added this to the v0.8.0 milestone Sep 14, 2023
@jkiviluo
Copy link
Member Author

jkiviluo commented Sep 14, 2023

With data included, I got this error (and commit apparently failed. EDIT: apparently succeeded despite the message):

DBAPIError while inserting entity_class items: ('UNIQUE constraint failed: entity_class_dimension.entity_class_id, entity_class_dimension.dimension_id, entity_class_dimension.position',)

@PiispaH
Copy link
Collaborator

PiispaH commented Sep 14, 2023

Might be related to #2293 and #2296

@jkiviluo
Copy link
Member Author

jkiviluo commented Sep 14, 2023

Right. And the data wasn't actually committed. I closed and opened the DB editor, but that's not enough (apparently stuff remains in the memory). Only closing and starting Toolbox revealed that new entity class and it's data were not in the DB.

@manuelma
Copy link
Collaborator

What are steps to reproduce this? I just added and committed an empty multi-D class with no problem?

@jkiviluo
Copy link
Member Author

It works for me too, if I start from an empty DB. But fails on the attached one. Of course, maybe it's due to corrupt DB that wouldn't happen anymore, so not sure if should be debugged (and I would just need to reimplement my DB).

generic_energy_data_specification.sqlite.txt

@jkiviluo
Copy link
Member Author

I tried to look into this, since it's stopping me from progressing. It seems like the referential integrity between entity_class and entity_class_dimension tables is not working. I have rows in entity_class_dimension that have entity_class_ids not found in entity_class (since the database has seen deletion of entity_classes). This causes the error message when trying to insert records that would re-use the entity_class_id numbers.

I don't know where to fix this... Probably somewhere in the database definition, but I leave it to you @manuelma. I'll try to fix my database manually meanwhile.

@manuelma
Copy link
Collaborator

My hope is @PiispaH already fixed this with spine-tools/Spine-Database-API@7fa4b1e

It is somewhat clear to me how things would get messy the way you @jkiviluo describe, prior to the changes introduced by @PiispaH in the above commit.

Should we try and save the corrupted DBs? there might be a way...

@jkiviluo
Copy link
Member Author

No need on my part - I've already remade the DB. So, unless someone requests that, let's not waste time trying to do that. Presumably there are so many ways things can go wrong that it can be futile.

@manuelma manuelma self-assigned this Sep 21, 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

3 participants