Setting autocommit=True is bad for performance, as a single batched commit is significantly faster than multiple commits. The way this is currently being managed is that private methods never commit, and public methods should always commit right before returning the value. However, this currently needs to be done imperatively at every possible return point in each public method, which is fragile.
Proposed Solution
There should be a @commit decorator that wraps every public method.
Problem
Forgetting to call
self.con.commit()
imperatively can be the source of a lot of silly bugs, as seen in https://github.com/jupyter-server/jupyter_server_fileid/pull/63.Setting
autocommit=True
is bad for performance, as a single batched commit is significantly faster than multiple commits. The way this is currently being managed is that private methods never commit, and public methods should always commit right before returning the value. However, this currently needs to be done imperatively at every possible return point in each public method, which is fragile.Proposed Solution
There should be a
@commit
decorator that wraps every public method.