Skip to content

Commit

Permalink
fixup! fallback for a cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
mckornfield committed Aug 5, 2024
1 parent 2d53c16 commit feb64c5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/gretel_trainer/relational/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,15 +723,19 @@ def get_descendants(self, table: str) -> list[str]:
and all subsequent tables that are discovered.
"""

def _add_children(descendants, table):
def _add_children(descendants: set, table: str, visited: set):
children = list(self.graph.predecessors(table))
if len(children) > 0:
descendants.update(children)
for child in children:
_add_children(descendants, child)
if child in visited:
continue
visited.add(child)
_add_children(descendants, child, visited)

visited = set()
descendants = set()
_add_children(descendants, table)
_add_children(descendants, table, visited)

return list(descendants)

Expand Down

0 comments on commit feb64c5

Please sign in to comment.