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

Force commit message in commit_session(); filter empty commits in commit_sq #156

Closed soininen closed 2 years ago

soininen commented 2 years ago

DatabaseMapping keeps an empty commit around while database connection is open which is used to provide a commit id for things that are still being added/updated. The commit becomes a concrete commit once the session is actually committed. The empty commit is an implementation detail and should not be exposed to users. However, it can be queried using commit_sq.

We could do the following changes to hide the empty commit:

  1. Force commit message by raising an exception in commit_session() if the message is empty
  2. Filter out commits without messages (empty comment column) in commit_sq
manuelma commented 2 years ago

This works, I don't see any flaws really.

soininen commented 2 years ago

Done.