Пример #1
0
 def getConnection(self) -> sqlite3.Connection:
     try:
         con = sqlite3.connect(constants.DATABASE_FILE)
     except sqlite3.Error as e:
         self.logError(
             f'Failed to connect to DB ({constants.DATABASE_FILE}): {e}')
         raise DbConnectionError()
     con.row_factory = sqlite3.Row
     return con
Пример #2
0
 def getConnection(self) -> sqlite3.Connection:
     try:
         con = sqlite3.connect(commons.getDatabaseFile())
     except sqlite3.Error as e:
         self._logger.error(
             f'[{self.name}] Failed to connect to DB ({commons.getDatabaseFile()}): {e}'
         )
         raise DbConnectionError(e)
     con.row_factory = sqlite3.Row
     return con
 def getConnection(self) -> sqlite3.Connection:
     try:
         if self.ConfigManager.getAliceConfigByName('databaseProfiling'):
             self.logDebug(
                 f'DB lock acquired by {CommonsManager.getFunctionCaller(depth=5)}->{CommonsManager.getFunctionCaller(depth=4)}->{CommonsManager.getFunctionCaller(depth=3)}'
             )
         con = sqlite3.connect(constants.DATABASE_FILE, timeout=10)
     except sqlite3.Error as e:
         self.logError(
             f'Failed to connect to DB ({constants.DATABASE_FILE}): {e}')
         raise DbConnectionError()
     con.row_factory = sqlite3.Row
     return con