Skip to content

Commit

Permalink
Merge pull request #2033 from fedspendingtransparency/fix/staging-ci-…
Browse files Browse the repository at this point in the history
…checks

Fixing Travis-CI checks after Hotfix introduced issue
  • Loading branch information
tony-sappe authored Sep 13, 2019
2 parents 912447e + e9e6eb6 commit 12794fd
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,14 @@ def apply_annotations_to_sql(raw_query, aliases):

# Extract everything between the first SELECT and the last FROM
query_before_group_by = raw_query.split("GROUP BY ")[0]
query_before_from = re.sub(r"\(?SELECT ", "", " FROM".join(re.split(" FROM", query_before_group_by)[:-1]), count=1)
query_before_from = re.sub(
r"\(?SELECT ", "", " FROM".join(re.split(" FROM", query_before_group_by)[:-1]), count=1
)

# Create a list from the non-derived values between SELECT and FROM
selects_str = re.findall(r"SELECT (.*?) (CASE|CONCAT|SUM|COALESCE|STRING_AGG|EXTRACT|\(SELECT|FROM)", raw_query)[0]
selects_str = re.findall(
r"SELECT (.*?) (CASE|CONCAT|SUM|COALESCE|STRING_AGG|EXTRACT|\(SELECT|FROM)", raw_query
)[0]
just_selects = selects_str[0] if selects_str[1] == "FROM" else selects_str[0][:-1]
selects_list = [select.strip() for select in just_selects.strip().split(",")]

Expand Down

0 comments on commit 12794fd

Please sign in to comment.