From 27656853859cbb1e70e980a0e3476ff83dbc013e Mon Sep 17 00:00:00 2001 From: Omen Apps Date: Sun, 22 Nov 2020 11:32:31 -0500 Subject: [PATCH] Removed query_strings.py as it is no longer needed --- django_postgresql_dag/models.py | 1 - django_postgresql_dag/query_strings.py | 23 ----------------------- 2 files changed, 24 deletions(-) delete mode 100644 django_postgresql_dag/query_strings.py 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; -""" -