summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Uriarte <victor.m.uriarte@intel.com>2017-02-07 18:53:57 -0700
committerVictor Uriarte <victor.m.uriarte@intel.com>2017-02-07 18:53:57 -0700
commitd67c442db4fd8b60a97440e84b9c21e80e4e958c (patch)
treeb2da53ac3c84d31d750e349a899707187938df04
parent8e039bc6b8a6ac29c64e380552e156d1b5bff4d7 (diff)
parent18dbc4d3aad10fa5d8fa206e7ba0d15dcf3fc52c (diff)
downloadsqlparse-d67c442db4fd8b60a97440e84b9c21e80e4e958c.tar.gz
Merge pull request #321 from romainr/patch-1
Putting LIMIT on a new line #320
-rw-r--r--AUTHORS1
-rw-r--r--sqlparse/filters/reindent.py2
-rw-r--r--tests/test_regressions.py5
3 files changed, 5 insertions, 3 deletions
diff --git a/AUTHORS b/AUTHORS
index 8615a2b..a1f1f83 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -32,6 +32,7 @@ Alphabetical list of contributors:
* quest <quest@wonky.windwards.net>
* Robert Nix <com.github@rnix.org>
* Rocky Meza <rmeza@fusionbox.com>
+* Romain Rigaux <romain.rigaux@gmail.com>
* Ryan Wooden <rygwdn@gmail.com>
* saaj <id@saaj.me>
* Shen Longxing <shenlongxing2012@gmail.com>
diff --git a/sqlparse/filters/reindent.py b/sqlparse/filters/reindent.py
index ede2d27..f077849 100644
--- a/sqlparse/filters/reindent.py
+++ b/sqlparse/filters/reindent.py
@@ -51,7 +51,7 @@ class ReindentFilter(object):
def _next_token(self, tlist, idx=-1):
split_words = ('FROM', 'STRAIGHT_JOIN$', 'JOIN$', 'AND', 'OR',
'GROUP', 'ORDER', 'UNION', 'VALUES',
- 'SET', 'BETWEEN', 'EXCEPT', 'HAVING')
+ 'SET', 'BETWEEN', 'EXCEPT', 'HAVING', 'LIMIT')
m_split = T.Keyword, split_words, True
tidx, token = tlist.token_next_by(m=m_split, idx=idx)
diff --git a/tests/test_regressions.py b/tests/test_regressions.py
index b9a73a2..cf88419 100644
--- a/tests/test_regressions.py
+++ b/tests/test_regressions.py
@@ -43,13 +43,14 @@ def test_issue34(value):
def test_issue35():
- # missing space before LIMIT
+ # missing space before LIMIT. Updated for #321
sql = sqlparse.format("select * from foo where bar = 1 limit 1",
reindent=True)
assert sql == "\n".join([
"select *",
"from foo",
- "where bar = 1 limit 1"])
+ "where bar = 1",
+ "limit 1"])
def test_issue38():