Created
June 14, 2017 18:59
-
-
Save mdellavo/6293539b006f36ca412de0409c5dd488 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_dependent_tables_for(table, referenced=None): | |
referenced = referenced or set([table]) | |
for fk in table.foreign_keys: | |
other_table = fk.column.table | |
if other_table not in referenced: | |
referenced.add(other_table) | |
get_dependent_tables_for(other_table, referenced=referenced) | |
return referenced |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment