diff --git a/django_postgresql_dag/models.py b/django_postgresql_dag/models.py index 67a6d2e..7822df5 100644 --- a/django_postgresql_dag/models.py +++ b/django_postgresql_dag/models.py @@ -13,7 +13,6 @@ from .exceptions import NodeNotReachableException from .transformations import _ordered_filter -from .query_strings import * from .query_builders import ( AncestorQuery, DescendantQuery, diff --git a/django_postgresql_dag/query_strings.py b/django_postgresql_dag/query_strings.py deleted file mode 100644 index 2b21c8c..0000000 --- a/django_postgresql_dag/query_strings.py +++ /dev/null @@ -1,23 +0,0 @@ - -# DISALLOWED_ANCESTORS_NODES_CLAUSE_1 = """AND second.child_pk <> ALL(%(disallowed_ancestors_node_pks)s)""" # Used for ancestors and upward path -# DISALLOWED_ANCESTORS_NODES_CLAUSE_2 = ("""AND {relationship_table}.child_pk <> ALL(%(disallowed_ancestors_node_pks)s)""") - -# DISALLOWED_DESCENDANTS_NODES_CLAUSE_1 = """AND second.parent_pk <> ALL(%(disallowed_descendants_node_pks)s)""" # Used for descendants and downward path -# DISALLOWED_DESCENDANTS_NODES_CLAUSE_2 = """AND {relationship_table}.parent_pk <> ALL(%(disallowed_descendants_node_pks)s)""" - - - -CLUSTER_QUERY = """ -WITH RECURSIVE traverse(path, last_parent, last_child) AS ( - SELECT ARRAY[id], id, id - FROM {node_table} WHERE id = %(starting_node)s -- starting node -UNION ALL - SELECT tv.path || edge.child_id || edge.parent_id, edge.profile1_id, edge.child_id - FROM traverse tv - JOIN {relationship_table} edge - ON (edge.parent_id = tv.last_child AND NOT path @> array[edge.child_id]) - OR (edge.child_id = tv.last_parent AND NOT path @> array[edge.parent_id]) -) -SELECT distinct unnest(path) FROM traverse; -""" -