diff options
| author | Ihar Hrachyshka <ihrachys@redhat.com> | 2015-01-14 00:09:32 +0100 |
|---|---|---|
| committer | Ihar Hrachyshka <ihrachys@redhat.com> | 2015-01-14 01:45:25 +0100 |
| commit | b9caaae4fccb1d6f8dea575ff318975fe197edde (patch) | |
| tree | 8692c97fd05897feb3946678077a152db941d4ad /migrate/versioning/script | |
| parent | b011e6cb39401a72c29b9ba60345c644d4032897 (diff) | |
| download | sqlalchemy-migrate-b9caaae4fccb1d6f8dea575ff318975fe197edde.tar.gz | |
script: strip comments in SQL statements
Regular expression does not match correctly against statements that contain
comments at their start. So strip those comments first (and whitespaces, while
we are at it).
Change-Id: Iad9b544bf995374d76cab1e125658aae2f8511f4
Closes-Bug: #1410494
Diffstat (limited to 'migrate/versioning/script')
| -rw-r--r-- | migrate/versioning/script/sql.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/migrate/versioning/script/sql.py b/migrate/versioning/script/sql.py index 4b0536d..862bc9f 100644 --- a/migrate/versioning/script/sql.py +++ b/migrate/versioning/script/sql.py @@ -54,6 +54,7 @@ class SqlScript(base.BaseScript): # not all drivers reliably handle multistatement queries or # commands passed to .execute(), so split them and execute one # by one + text = sqlparse.format(text, strip_comments=True, strip_whitespace=True) for statement in sqlparse.split(text): if statement: if re.match(ignored_regex, statement): |
