def db(self): if self._db is None: self._db = sqlite.connect(self.database_file, check_same_thread=False) # Check schema version, upgrade if necessary schema.upgrade(self._db, self.database_file) logger.debug('Database opened.') return self._db
def db(self): if self._db is None: self._db = sqlite.connect(self.database_file, check_same_thread=False) # Check schema version, upgrade if necessary schema.upgrade(self._db, self.database_file) # Sanity checks for the data in the database schema.check_data(self) logger.debug("Database opened.") return self._db