def update_sequence(tablenames): engine = DBSession.bind metadata = MetaData(engine) for item in fixtures: tablename = item[0] if tablename not in tablenames: continue schema, tablename = split_tablename(tablename) class T(Base): __table__ = Table(tablename, metadata, autoload=True, schema=schema) set_sequence(T)