I have a self referencing table like the following:

class Employee(Base):
    __tablename__ = "t_employee"


    id = sa.Column(BigInteger, sa.Sequence('%s_id_seq' % __tablename__), 
primary_key=True, nullable=False)
    manager_id = sa.Column(BigInteger, sa.ForeignKey("t_employee.id", 
ondelete='SET NULL'))



I want to select all rows ordered by their dependency (much like 
metadata.sorted_tables does for tables). E.g - each manager should come 
before his employees

What is the best way to achieve this (assuming the blunt 
load-it-all-and-order-it is not the best method)?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to