diff options
Diffstat (limited to 'examples/materialized_paths/materialized_paths.py')
| -rw-r--r-- | examples/materialized_paths/materialized_paths.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/examples/materialized_paths/materialized_paths.py b/examples/materialized_paths/materialized_paths.py index f777f131b..37e91684c 100644 --- a/examples/materialized_paths/materialized_paths.py +++ b/examples/materialized_paths/materialized_paths.py @@ -62,17 +62,15 @@ class Node(Base): # Finding the ancestors is a little bit trickier. We need to create a fake # secondary table since this behaves like a many-to-many join. secondary = select( - [ - id.label("id"), - func.unnest( - cast( - func.string_to_array( - func.regexp_replace(path, r"\.?\d+$", ""), "." - ), - ARRAY(Integer), - ) - ).label("ancestor_id"), - ] + id.label("id"), + func.unnest( + cast( + func.string_to_array( + func.regexp_replace(path, r"\.?\d+$", ""), "." + ), + ARRAY(Integer), + ) + ).label("ancestor_id"), ).alias() ancestors = relationship( "Node", |
