Hi Mike, thanks for pointing out the direction.
I've worked out the SQL, but failed when converting to SQLAlchemy construct.
My SQL query looks like this:
SELECT id, (
WITH lineage_nodes (id, _enabling_factor, selfreferencing_staff_id)
AS
(
SELECT anchor_s.id, anchor_
this is a hefty query to dig in to but column_property() subqueries have to be
formed in terms of a correlated subquery. So instead of injecting a particular
primary key into it, you set it to point to the Staff.id column.
correlated subqueries are not terrific performers and the construct can