diff --git a/setup.py b/setup.py index b04e3b1..3e257f8 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ 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 a24f4b0..901609c 100644 --- a/voussoirkit/sqlhelpers.py +++ b/voussoirkit/sqlhelpers.py @@ -1,3 +1,5 @@ +import re +import sqlparse import types def delete_filler(pairs): @@ -162,9 +164,8 @@ def listify(items): return output def _extract_create_table_statements(script): + script = sqlparse.format(script, strip_comments=True) for statement in script.split(';'): - statement = statement.strip() - statement = statement.strip('-') statement = statement.strip() if statement.lower().startswith('create table'): yield statement