diff options
author | ptmcg <ptmcg@austin.rr.com> | 2021-08-01 12:57:10 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2021-08-01 12:57:10 -0500 |
commit | f22dcdc9be6aebf7defc1ef43e39c53921ba7566 (patch) | |
tree | d40b225f53c90a0b4676c59323251c9c2c825df6 /examples/bigquery_view_parser.py | |
parent | 1688592bd97e573174e9eab482846e0f1194652a (diff) | |
download | pyparsing-git-f22dcdc9be6aebf7defc1ef43e39c53921ba7566.tar.gz |
Update __versionTime__; blacken core code and examples
Diffstat (limited to 'examples/bigquery_view_parser.py')
-rw-r--r-- | examples/bigquery_view_parser.py | 273 |
1 files changed, 226 insertions, 47 deletions
diff --git a/examples/bigquery_view_parser.py b/examples/bigquery_view_parser.py index 433a127..c9b8411 100644 --- a/examples/bigquery_view_parser.py +++ b/examples/bigquery_view_parser.py @@ -844,61 +844,98 @@ if __name__ == "__main__": """ SELECT x FROM y.a, b """, - [(None, "y", "a"), (None, None, "b",),], + [ + (None, "y", "a"), + ( + None, + None, + "b", + ), + ], ], [ """ SELECT x FROM y.a JOIN b """, - [(None, "y", "a"), (None, None, "b"),], + [ + (None, "y", "a"), + (None, None, "b"), + ], ], [ """ select * from xyzzy where z > 100 """, - [(None, None, "xyzzy"),], + [ + (None, None, "xyzzy"), + ], ], [ """ select * from xyzzy where z > 100 order by zz """, - [(None, None, "xyzzy"),], + [ + (None, None, "xyzzy"), + ], ], [ """ select * from xyzzy """, - [(None, None, "xyzzy",),], + [ + ( + None, + None, + "xyzzy", + ), + ], ], [ """ select z.* from xyzzy """, - [(None, None, "xyzzy",),], + [ + ( + None, + None, + "xyzzy", + ), + ], ], [ """ select a, b from test_table where 1=1 and b='yes' """, - [(None, None, "test_table"),], + [ + (None, None, "test_table"), + ], ], [ """ select a, b from test_table where 1=1 and b in (select bb from foo) """, - [(None, None, "test_table"), (None, None, "foo"),], + [ + (None, None, "test_table"), + (None, None, "foo"), + ], ], [ """ select z.a, b from test_table where 1=1 and b in (select bb from foo) """, - [(None, None, "test_table"), (None, None, "foo"),], + [ + (None, None, "test_table"), + (None, None, "foo"), + ], ], [ """ select z.a, b from test_table where 1=1 and b in (select bb from foo) order by b,c desc,d """, - [(None, None, "test_table"), (None, None, "foo"),], + [ + (None, None, "test_table"), + (None, None, "foo"), + ], ], [ """ @@ -914,25 +951,35 @@ if __name__ == "__main__": """ select a, db.table.b as BBB from db.table where 1=1 and BBB='yes' """, - [(None, "db", "table"),], + [ + (None, "db", "table"), + ], ], [ """ select a, db.table.b as BBB from test_table,db.table where 1=1 and BBB='yes' """, - [(None, None, "test_table"), (None, "db", "table"),], + [ + (None, None, "test_table"), + (None, "db", "table"), + ], ], [ """ select a, db.table.b as BBB from test_table,db.table where 1=1 and BBB='yes' limit 50 """, - [(None, None, "test_table"), (None, "db", "table"),], + [ + (None, None, "test_table"), + (None, "db", "table"), + ], ], [ """ select a, b from test_table where (1=1 or 2=3) and b='yes' group by zx having b=2 order by 1 """, - [(None, None, "test_table"),], + [ + (None, None, "test_table"), + ], ], [ """ @@ -947,31 +994,44 @@ if __name__ == "__main__": #yup, a comment group by zx having b=2 order by 1 """, - [(None, None, "test_table"),], + [ + (None, None, "test_table"), + ], ], [ """ SELECT COUNT(DISTINCT foo) FROM bar JOIN baz ON bar.baz_id = baz.id """, - [(None, None, "bar"), (None, None, "baz"),], + [ + (None, None, "bar"), + (None, None, "baz"), + ], ], [ """ SELECT COUNT(DISTINCT foo) FROM bar, baz WHERE bar.baz_id = baz.id """, - [(None, None, "bar"), (None, None, "baz"),], + [ + (None, None, "bar"), + (None, None, "baz"), + ], ], [ """ WITH one AS (SELECT id FROM foo) SELECT one.id """, - [(None, None, "foo"),], + [ + (None, None, "foo"), + ], ], [ """ WITH one AS (SELECT id FROM foo), two AS (select id FROM bar) SELECT one.id, two.id """, - [(None, None, "foo"), (None, None, "bar"),], + [ + (None, None, "foo"), + (None, None, "bar"), + ], ], [ """ @@ -981,7 +1041,13 @@ if __name__ == "__main__": ROW_NUMBER() OVER (PARTITION BY x ORDER BY y) AS row_num FROM a """, - [(None, None, "a",),], + [ + ( + None, + None, + "a", + ), + ], ], [ """ @@ -989,7 +1055,13 @@ if __name__ == "__main__": RANGE BETWEEN 2 PRECEDING AND 2 FOLLOWING ) AS count_x FROM T """, - [(None, None, "T",),], + [ + ( + None, + None, + "T", + ), + ], ], [ """ @@ -997,7 +1069,9 @@ if __name__ == "__main__": RANK() OVER ( PARTITION BY department ORDER BY startdate ) AS rank FROM Employees """, - [(None, None, "Employees"),], + [ + (None, None, "Employees"), + ], ], # A fragment from https://cloud.google.com/bigquery/docs/reference/standard-sql/navigation_functions [ @@ -1334,7 +1408,9 @@ if __name__ == "__main__": FROM bar """, - [(None, None, "bar"),], + [ + (None, None, "bar"), + ], ], [ """ @@ -1387,7 +1463,13 @@ if __name__ == "__main__": case when (a) then b else c end FROM d """, - [(None, None, "d",),], + [ + ( + None, + None, + "d", + ), + ], ], [ """ @@ -1396,7 +1478,13 @@ if __name__ == "__main__": case when (f) then g else h end FROM i """, - [(None, None, "i",),], + [ + ( + None, + None, + "i", + ), + ], ], [ """ @@ -1404,7 +1492,13 @@ if __name__ == "__main__": case when j then k else l end FROM m """, - [(None, None, "m",),], + [ + ( + None, + None, + "m", + ), + ], ], [ """ @@ -1413,7 +1507,13 @@ if __name__ == "__main__": case when o then p else q end FROM r """, - [(None, None, "r",),], + [ + ( + None, + None, + "r", + ), + ], ], [ """ @@ -1421,7 +1521,13 @@ if __name__ == "__main__": case s when (t) then u else v end FROM w """, - [(None, None, "w",),], + [ + ( + None, + None, + "w", + ), + ], ], [ """ @@ -1430,7 +1536,13 @@ if __name__ == "__main__": case y when (z) then aa else ab end FROM ac """, - [(None, None, "ac",),], + [ + ( + None, + None, + "ac", + ), + ], ], [ """ @@ -1438,7 +1550,13 @@ if __name__ == "__main__": case ad when ae then af else ag end FROM ah """, - [(None, None, "ah",),], + [ + ( + None, + None, + "ah", + ), + ], ], [ """ @@ -1447,7 +1565,13 @@ if __name__ == "__main__": case aj when ak then al else am end FROM an """, - [(None, None, "an",),], + [ + ( + None, + None, + "an", + ), + ], ], [ """ @@ -1456,7 +1580,18 @@ if __name__ == "__main__": TWO AS (select a FROM b) SELECT y FROM onE JOIN TWo """, - [(None, None, "y",), (None, None, "b",),], + [ + ( + None, + None, + "y", + ), + ( + None, + None, + "b", + ), + ], ], [ """ @@ -1465,67 +1600,98 @@ if __name__ == "__main__": (SELECT b FROM oNE) FROM OnE """, - [(None, None, "oNE",), (None, None, "OnE",),], + [ + ( + None, + None, + "oNE", + ), + ( + None, + None, + "OnE", + ), + ], ], [ """ SELECT * FROM `a.b.c` """, - [("a", "b", "c"),], + [ + ("a", "b", "c"), + ], ], [ """ SELECT * FROM `b.c` """, - [(None, "b", "c"),], + [ + (None, "b", "c"), + ], ], [ """ SELECT * FROM `c` """, - [(None, None, "c"),], + [ + (None, None, "c"), + ], ], [ """ SELECT * FROM a.b.c """, - [("a", "b", "c"),], + [ + ("a", "b", "c"), + ], ], [ """ SELECT * FROM "a"."b"."c" """, - [("a", "b", "c"),], + [ + ("a", "b", "c"), + ], ], [ """ SELECT * FROM 'a'.'b'.'c' """, - [("a", "b", "c"),], + [ + ("a", "b", "c"), + ], ], [ """ SELECT * FROM `a`.`b`.`c` """, - [("a", "b", "c"),], + [ + ("a", "b", "c"), + ], ], [ """ SELECT * FROM "a.b.c" """, - [("a", "b", "c"),], + [ + ("a", "b", "c"), + ], ], [ """ SELECT * FROM 'a.b.c' """, - [("a", "b", "c"),], + [ + ("a", "b", "c"), + ], ], [ """ SELECT * FROM `a.b.c` """, - [("a", "b", "c"),], + [ + ("a", "b", "c"), + ], ], [ """ @@ -1534,14 +1700,21 @@ if __name__ == "__main__": WHERE t1.a IN (SELECT t2.a FROM t2 ) FOR SYSTEM_TIME AS OF t1.timestamp_column) """, - [(None, None, "t1"), (None, None, "t2"),], + [ + (None, None, "t1"), + (None, None, "t2"), + ], ], [ """ WITH a AS (SELECT b FROM c) SELECT d FROM A JOIN e ON f = g JOIN E ON h = i """, - [(None, None, "c"), (None, None, "e"), (None, None, "E"),], + [ + (None, None, "c"), + (None, None, "e"), + (None, None, "E"), + ], ], [ """ @@ -1561,7 +1734,11 @@ if __name__ == "__main__": select g from h """, - [(None, None, "d"), (None, None, "f"), (None, None, "h"),], + [ + (None, None, "d"), + (None, None, "f"), + (None, None, "h"), + ], ], [ """ @@ -1573,7 +1750,9 @@ if __name__ == "__main__": e AS DATE_ADD FROM x """, - [(None, None, "x"),], + [ + (None, None, "x"), + ], ], [ """ |