Skip to content

Commit

Permalink
Account for multiple "and" and "or"
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed May 3, 2024
1 parent 12999bc commit 5d56ad6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/python/select_from_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
def columns_in_query(query):
"""Returns all the identifiers used in the query."""
result = re.findall(r"""(?<!['"])\b[A-Za-z][A-Za-z_]*\b(?!['"])""", query)
if "and" in result:
while "and" in result:
result.remove("and")
if "or" in result:
while "or" in result:
result.remove("or")
return result

Expand Down Expand Up @@ -71,8 +71,6 @@ def main():
# Gross way to produce output to standard out
with tempfile.NamedTemporaryFile() as tmpfile:
df.to_csv(tmpfile)
print("tmpfile:")
print(tmpfile.name)
system("cat " + tmpfile.name)


Expand Down

0 comments on commit 5d56ad6

Please sign in to comment.