The purpose is to reduce the number of database transaction.
The basic idea is that all database patterns follow the pattern
with xyzDatabase() as db:
The enter starts a transaction and caches a cursor
SQLiteDB has a few pass through methods which check the cursor/transaction exists and uses that
Exit commits the transaction and nukes the cached cursor so it can not be reused.
Most changes are just tabbing after the removal of the
with self.transaction() as cursor:
While NOT recommended it is possible to have two xyzDatabase Objects open on the same file
BUT if you write to both it goes BOOM!
see test_double_with
The pattern
with DsSqlliteDatabase() as db:
dsg = DataSpecificationGenerator(0, 1, 3, vertex, db)
looks strange in tests but was used so that
_GraphDataSpecificationWriter runs the whole generation in a single transaction
A few code changes includes:
The View now holds the path of the DsSqlliteDatabase
coverage: 42.293% (-0.2%) from 42.508% when pulling b02f10ef5253f7a713234e78813b5409c63f4fe9 on with_database into 9a8366760c3ce4bbdd90369dc28b956284340810 on master.
This Pr is based on ideas from https://github.com/SpiNNakerManchester/SpiNNFrontEndCommon/pull/1062
The purpose is to reduce the number of database transaction.
The basic idea is that all database patterns follow the pattern with xyzDatabase() as db:
Most changes are just tabbing after the removal of the with self.transaction() as cursor:
While NOT recommended it is possible to have two xyzDatabase Objects open on the same file BUT if you write to both it goes BOOM! see test_double_with
The pattern with DsSqlliteDatabase() as db: dsg = DataSpecificationGenerator(0, 1, 3, vertex, db) looks strange in tests but was used so that _GraphDataSpecificationWriter runs the whole generation in a single transaction
A few code changes includes:
Must be Done at the same time as: https://github.com/SpiNNakerManchester/SpiNNMan/pull/361 https://github.com/SpiNNakerManchester/sPyNNaker/pull/1385