subq2 = session.query(func.regexp_split_to_table(subq1.c.group_name, ',').
    distinct().label('group')).subquery()
q = session.query(subq2.c.group).filter(subq2.c.group.like(term)).order_by(
    subq2.c.group).limit(limit)
SQLAlchemy subquery in from clause without join