Skip to content

Commit

Permalink
Reformat the SQL statements to look more similar to each other
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Apr 25, 2024
1 parent 7cd5567 commit 78fb7ba
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions tree_queries/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,21 @@ class TreeCompiler(SQLCompiler):
"""

CTE_MYSQL = """
WITH RECURSIVE __rank_table({tree_fields_columns} {pk}, {parent}, rank_order) AS (
WITH RECURSIVE __rank_table(
{tree_fields_columns}
{pk},
{parent},
rank_order
) AS (
{rank_table}
),
__tree({tree_fields_names} tree_depth, tree_path, tree_ordering, tree_pk) AS (
__tree(
{tree_fields_names}
tree_depth,
tree_path,
tree_ordering,
tree_pk
) AS (
SELECT
{tree_fields_initial}
0,
Expand All @@ -133,10 +144,21 @@ class TreeCompiler(SQLCompiler):
"""

CTE_SQLITE = """
WITH RECURSIVE __rank_table({tree_fields_columns} {pk}, {parent}, rank_order) AS (
WITH RECURSIVE __rank_table(
{tree_fields_columns}
{pk},
{parent},
rank_order
) AS (
{rank_table}
),
__tree({tree_fields_names} tree_depth, tree_path, tree_ordering, tree_pk) AS (
__tree(
{tree_fields_names}
tree_depth,
tree_path,
tree_ordering,
tree_pk
) AS (
SELECT
{tree_fields_initial}
0,
Expand Down

0 comments on commit 78fb7ba

Please sign in to comment.