Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
klahnakoski committed May 31, 2024
1 parent 9cb5e1d commit 18d36a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion mo_sql_parsing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"bigquery_parser": {"*": None, None: None},
}


SQL_NULL: Mapping[str, Mapping] = {"null": {}}


Expand Down
8 changes: 4 additions & 4 deletions mo_sql_parsing/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def isolate(expr, sql, prec):
"where",
"groupby",
"having",
"union_all"
"union_all",
]

ordered_clauses = [
Expand Down Expand Up @@ -274,7 +274,7 @@ def wordy(v):
# WITHIN GROUP (
# ORDER BY public.persentil.sale
# )
ob = self.orderby(json['within'], 100)
ob = self.orderby(json["within"], 100)
parts.append(f"WITHIN GROUP ({ob})")
if "name" in json:
parts.extend(["AS", self.dispatch(json["name"])])
Expand Down Expand Up @@ -590,7 +590,7 @@ def unordered_query(self, json, prec):
part
for clause in unordered_clauses
if clause in json
for part in [getattr(self, clause)(json, precedence[clause]+1)]
for part in [getattr(self, clause)(json, precedence[clause] + 1)]
if part
)
if prec > precedence["from"]:
Expand All @@ -604,7 +604,7 @@ def with_(self, json, prec):
return f"WITH {parts}"

def union_all(self, json, prec):
sql = "\nUNION ALL\n".join(self.dispatch(part) for part in listwrap(json['union_all']))
sql = "\nUNION ALL\n".join(self.dispatch(part) for part in listwrap(json["union_all"]))
return f"{sql}" if prec > precedence["union_all"] else f"({sql})"

def select(self, json, prec):
Expand Down

0 comments on commit 18d36a8

Please sign in to comment.