diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-19 14:50:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-19 14:50:39 +0000 |
commit | f2981e8e4d28233864f1ca06ecec45ab80bf9eae (patch) | |
tree | b70cb633916830138ce3424aa361f0bbaff02be2 /benchmarks | |
parent | Releasing debian version 10.0.1-1. (diff) | |
download | sqlglot-f2981e8e4d28233864f1ca06ecec45ab80bf9eae.tar.xz sqlglot-f2981e8e4d28233864f1ca06ecec45ab80bf9eae.zip |
Merging upstream version 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 |