From b0c33b8137141e74aaf5f64a6d58af959b61e33b Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Tue, 25 Feb 2020 10:41:13 -0800 Subject: [PATCH] Nevermind about sqlparse, too slow for my taste at the moment. This was adding about 100ms to my start times for Etiquette, which is too high as I'm trying to make Etiquette more cli friendly. --- setup.py | 1 - voussoirkit/sqlhelpers.py | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 3e257f8..b04e3b1 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,6 @@ setuptools.setup( url='https://github.com/voussoir/voussoirkit', install_requires=[ 'pyperclip', - 'sqlparse', 'pywin32;platform_system=="Windows"', 'winshell;platform_system=="Windows"', ] diff --git a/voussoirkit/sqlhelpers.py b/voussoirkit/sqlhelpers.py index 901609c..d33e8c5 100644 --- a/voussoirkit/sqlhelpers.py +++ b/voussoirkit/sqlhelpers.py @@ -1,5 +1,4 @@ import re -import sqlparse import types def delete_filler(pairs): @@ -164,7 +163,9 @@ def listify(items): return output def _extract_create_table_statements(script): - script = sqlparse.format(script, strip_comments=True) + # script = sqlparse.format(script, strip_comments=True) + # script = re.sub(r'\s*--.+$', '', script, flags=re.MULTILINE) + script = re.sub(r'\n\s*create ', ';\ncreate ', script, flags=re.IGNORECASE) for statement in script.split(';'): statement = statement.strip() if statement.lower().startswith('create table'):