summaryrefslogtreecommitdiff
path: root/sqlparse/sql.py
diff options
context:
space:
mode:
authorandrew deryabin <github@djsf.com>2018-07-08 13:32:47 +0300
committerAndi Albrecht <albrecht.andi@gmail.com>2018-07-08 12:32:47 +0200
commit71fb55606b6092e7e57d587bd21672dc01a10711 (patch)
tree71ca720ab6e9c20d072b791bad5f6363084f3ede /sqlparse/sql.py
parent6dd17fa0e26900320c3cad697d5db2c9d70565a0 (diff)
downloadsqlparse-71fb55606b6092e7e57d587bd21672dc01a10711.tar.gz
fix "WITH name" case (#418)
* fix "WITH name" case * fix "WITH name" case (flake8 fix)
Diffstat (limited to 'sqlparse/sql.py')
-rw-r--r--sqlparse/sql.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/sqlparse/sql.py b/sqlparse/sql.py
index 4b78a92..5054128 100644
--- a/sqlparse/sql.py
+++ b/sqlparse/sql.py
@@ -418,7 +418,8 @@ class Statement(TokenList):
if isinstance(token, (Identifier, IdentifierList)):
_, dml_keyword = self.token_next(tidx, skip_ws=True)
- if dml_keyword.ttype == T.Keyword.DML:
+ if dml_keyword is not None \
+ and dml_keyword.ttype == T.Keyword.DML:
return dml_keyword.normalized
# Hmm, probably invalid syntax, so return unknown.