class FlaskExtension(object):

    def __init__(self, app=None, db=None):
        self.app = app
self.db = db
if app is not None and db is not None:
    self.init_app(app, db)
How do I access the SQLAlchemy database from my Flask extension?