'Returns a dictionary with a table->engine mapping.
This is suitable for use of sessionmaker(binds=db.get_binds(app)).'

def get_binds(self, app=None):

    app = self.get_app(app)
    binds = ([None] + list((app.config.get('SQLALCHEMY_BINDS') or ())))
    retval = {}
    for bind in binds:
        engine = self.get_engine(app, bind)
        tables = self.get_tables_for_bind(bind)
        retval.update(dict(((table, engine) for table in tables)))
    return retval
