Database: Disable alchemy pools
Want to use DBAPIs connection.row_factory so we can select() directly into a dict
This commit is contained in:
parent
8339ad1da6
commit
797c126318
|
@ -60,11 +60,14 @@ import Configuration
|
|||
# Other library modules
|
||||
try:
|
||||
import sqlalchemy.pool as pool
|
||||
use_pool = True
|
||||
#use_pool = True
|
||||
# Forcing to False so we can use connection.row_factory
|
||||
use_pool = False
|
||||
except ImportError:
|
||||
log.info(_("Not using sqlalchemy connection pool."))
|
||||
use_pool = False
|
||||
|
||||
|
||||
try:
|
||||
from numpy import var
|
||||
use_numpy = True
|
||||
|
@ -447,6 +450,7 @@ class Database:
|
|||
log.info(_("Connecting to SQLite: %(database)s") % {'database':self.db_path})
|
||||
if os.path.exists(database) or create:
|
||||
self.connection = sqlite3.connect(self.db_path, detect_types=sqlite3.PARSE_DECLTYPES)
|
||||
self.connection.row_factory = sqlite3.Row
|
||||
self.__connected = True
|
||||
sqlite3.register_converter("bool", lambda x: bool(int(x)))
|
||||
sqlite3.register_adapter(bool, lambda x: "1" if x else "0")
|
||||
|
|
Loading…
Reference in New Issue
Block a user