diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-19 14:50:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-19 14:50:35 +0000 |
commit | 2272764864555f26095563937e06a3389d42d789 (patch) | |
tree | 9dc37b7bff42ec0343028e5ecfb0aa147c5d3279 /benchmarks | |
parent | Adding upstream version 10.0.1. (diff) | |
download | sqlglot-2272764864555f26095563937e06a3389d42d789.tar.xz sqlglot-2272764864555f26095563937e06a3389d42d789.zip |
Adding upstream version 10.0.8.upstream/10.0.8
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'benchmarks')
-rw-r--r-- | benchmarks/bench.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/benchmarks/bench.py b/benchmarks/bench.py index cef62a8..2475608 100644 --- a/benchmarks/bench.py +++ b/benchmarks/bench.py @@ -5,8 +5,10 @@ collections.Iterable = collections.abc.Iterable import gc import timeit -import moz_sql_parser import numpy as np + +import sqlfluff +import moz_sql_parser import sqloxide import sqlparse import sqltree @@ -177,6 +179,10 @@ def sqloxide_parse(sql): sqloxide.parse_sql(sql, dialect="ansi") +def sqlfluff_parse(sql): + sqlfluff.parse(sql) + + def border(columns): columns = " | ".join(columns) return f"| {columns} |" @@ -193,6 +199,7 @@ def diff(row, column): libs = [ "sqlglot", + "sqlfluff", "sqltree", "sqlparse", "moz_sql_parser", @@ -206,7 +213,8 @@ for name, sql in {"tpch": tpch, "short": short, "long": long, "crazy": crazy}.it for lib in libs: try: row[lib] = np.mean(timeit.repeat(lambda: globals()[lib + "_parse"](sql), number=3)) - except: + except Exception as e: + print(e) row[lib] = "error" columns = ["Query"] + libs |