oe-lite / core

Official OE-lite/core repository - moved to GitLab.com
https://gitlab.com/oe-lite/core
Other
4 stars 17 forks source link

lib/oelite/cookbook.py: open database with isolation_level=None #226

Closed Villemoes closed 7 years ago

Villemoes commented 7 years ago

Using pysqlite >= 2.8 (the current version installed via pip is 2.8.3), oe-lite spits out

self.cookbook.db.execute("ATTACH ':memory:' AS runq")

OperationalError: cannot ATTACH database within transaction CRITICAL: bake failed: Exception: cannot ATTACH database within transaction

during initialization. This is due to a deliberate change in pysqlite

Fix this by completely disabling the "automatically open a transaction" logic for the database connection. For an in-memory database that is only accessed by a single process, transactions don't make much sense anyway. (If we ever wanted to do something where we might want to do a rollback, we can do a BEGIN manually.)

This should be compatible with all versions of pysqlite.