def database(self):
        """
        Before the callback is called, initialize the database if needed.
        :rtype: None
        """
        #1. Initialize
        self.callback.im_self.db = sql.setup(self.settings)
        if self.callback.im_self.db:
            module = '.'.join(self.callback.im_self.__module__.split('.')[:-1])
            sql.init(module, self.callback.im_self.db)
            self.callback.im_self.db.connect()
        yield
        #2. Cleanup
        if self.callback.im_self.db:
            self.callback.im_self.db.close()