summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2022-04-30 12:14:29 -0500
committerptmcg <ptmcg@austin.rr.com>2022-04-30 12:14:29 -0500
commit0ec8031ba42d3475afb906c64894538cca8d4c52 (patch)
treef29c02c4f05fcda5fc19547ef8eb18ac6270d960
parented37b35b4e47d0a153fe6030fd8aeb8443ae028b (diff)
downloadpyparsing-git-0ec8031ba42d3475afb906c64894538cca8d4c52.tar.gz
Added another test case to bigquery_view_parser.py
-rw-r--r--examples/bigquery_view_parser.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/bigquery_view_parser.py b/examples/bigquery_view_parser.py
index 1c99380..3ab13f3 100644
--- a/examples/bigquery_view_parser.py
+++ b/examples/bigquery_view_parser.py
@@ -1711,6 +1711,30 @@ if __name__ == "__main__":
[
"""\
SELECT
+ /* Replace white spaces in the title with underscores. */
+ REGEXP_REPLACE(title, r'\s+', '_') AS regexp_title, revisions
+ FROM
+ (SELECT title, COUNT(revision_id) as revisions
+ FROM
+ [bigquery-public-data:samples.wikipedia]
+ WHERE
+ wp_namespace=0
+ /* Match titles that start with 'G', end with
+ * 'e', and contain at least two 'o's.
+ */
+ AND REGEXP_MATCH(title, r'^G.*o.*o.*e$')
+ GROUP BY
+ title
+ ORDER BY
+ revisions DESC
+ LIMIT 100);""",
+ [
+ (None, 'bigquery-public-data:samples', 'wikipedia'),
+ ],
+ ],
+ [
+ """\
+ SELECT
page_title,
/* Populate these columns as True or False, */
/* depending on the condition */