Commit Graph

1147 Commits

Author SHA1 Message Date
Andi Albrecht 982ecdf1ef Bump version to 0.4.0. 2020-10-07 08:57:20 +02:00
Andi Albrecht 10b0ec24ce Update copyright notice. 2020-10-07 08:54:27 +02:00
Andi Albrecht 9a9c887012 Add Python 3.9-dev to Travis configuration.
Python 3.9 hasn't landed yet on Travis, but nightly is already 3.10.
2020-10-07 08:36:09 +02:00
Andi Albrecht 78d5b1bebb Move setup data to setup.cfg. 2020-10-07 08:32:45 +02:00
Andi Albrecht 412186cea9 Add Python 3.9 classifier. 2020-10-06 15:15:38 +02:00
Andi Albrecht fb8bde521d Too early, no Python 3.9 on Travis yet. 2020-10-06 15:11:02 +02:00
Andi Albrecht 967d0af8dd Add Python 3.9 to test configuration. 2020-10-06 15:05:17 +02:00
Andi Albrecht 11a6b7db8b Stabilize formatting of invalid WHERE clauses. 2020-09-30 15:39:54 +02:00
Andi Albrecht f578d03ef7 Improve formatting of type casts in parentheses. 2020-09-30 15:30:00 +02:00
Andi Albrecht 10231d89d7 Fix an issue with negative indexes causing IndexError in some cases. 2020-09-30 15:15:56 +02:00
Andi Albrecht d7b1ee37ad Fix splitting of statements using CASE ... WHEN (fixes #580). 2020-09-30 10:15:26 +02:00
Andi Albrecht 990500a149 Fix splitting when using DECLARE ... HANDLER (fixes #581). 2020-09-30 09:31:40 +02:00
Andi Albrecht cd4a723ee5 Don't make parsing of square bracket identifiers too greedy (fixes #583). 2020-09-30 08:11:53 +02:00
Andi Albrecht 3e8076dbe2 Update changelog and authors. 2020-09-30 07:26:40 +02:00
Will Jones a887b6d44a Add RLIKE keyword 2020-09-30 07:24:23 +02:00
Andi Albrecht 8cac74df73 Update changelog and authors. 2020-09-30 07:23:10 +02:00
ali-tny 4c570778b2 Add postgres WINDOW keyword
Postgres allows statements of the form:
```sql
SELECT col_1, col_2, SUM(col_3) OVER w
FROM x
WINDOW w AS (PARTITION BY col_1 ORDER BY col_2)
```
where the window is defined once at the end of the query (see
https://www.postgresql.org/docs/9.5/sql-select.html).

This change adds WINDOW as a postgres keyword, preventing queries like
the above being misparsed, with table name and WINDOW being grouped into
an single identifier <Identifier 'x WINDOW'>.
2020-09-30 07:21:06 +02:00
Andi Albrecht 1499cffcd7 Preserve line breaks when removing comments (fixes #484). 2020-09-13 13:29:36 +02:00
Andi Albrecht ca6d149e0a Add docs badge. 2020-09-13 12:25:23 +02:00
Andi Albrecht 03c4a3b5d8 Use coverage badge from codecov instead of coveralls. 2020-09-13 12:20:11 +02:00
Andi Albrecht df25ba7484 Remove changing our stdout encoding. 2020-09-13 12:07:22 +02:00
Andi Albrecht 27ad2564f3 Don't flush token streams iff they only contain whitespace tokens (fixes #496). 2020-09-13 09:25:56 +02:00
Andi Albrecht b4ba0697fc Update authors and changelog. 2020-09-13 09:22:13 +02:00
hurcy 28c4d4026e add regex pattern to identify IN as a Compasion token 2020-09-13 08:58:20 +02:00
Andi Albrecht d5d4bde3d8 Merge branch 'jdufresne-w503' 2020-09-13 08:55:38 +02:00
Andi Albrecht 27e859cbf8 Merge branch 'w503' of https://github.com/jdufresne/sqlparse into jdufresne-w503 2020-09-13 08:55:22 +02:00
Andi Albrecht 6cb3821bf3
Merge branch 'master' into w503 2020-09-13 08:54:12 +02:00
Jon Dufresne 686bf6d3c5 Remove unused pytest-travis-fold test dependency
The Travis configuration does not executed through tox since
f2a3a6ea35.
2020-09-13 08:50:16 +02:00
Andi Albrecht 7c90de6624 Correct capitalization of PyPy.
See also https://github.com/andialbrecht/sqlparse/pull/555
2020-09-13 08:47:53 +02:00
Jon Dufresne cc75926ca8 Document PyPy support with trove classifier 2020-09-13 08:46:38 +02:00
Andi Albrecht df45180ec8 Update tests to work with newer pytest version.
Also some unification of the tests.
2020-09-13 08:44:39 +02:00
Andi Albrecht fd2c8e3d42 Merge branch 'jdufresne-py2' 2020-09-13 08:22:57 +02:00
Andi Albrecht 6a02ed19fa
Merge branch 'master' into py2 2020-09-13 08:19:19 +02:00
Jon Dufresne 44965c2d15 Remove deprecated license_file from setup.cfg
Starting with wheel 0.32.0 (2018-09-29), the "license_file" option is
deprecated.

https://wheel.readthedocs.io/en/stable/news.html

The wheel will continue to include LICENSE, it is now included
automatically:

https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file
2020-09-13 08:10:44 +02:00
Jon Dufresne 3e3892f939 Remove support for end-of-life Pythons
Python 2.7 and 3.4 are end-of-life. They are no longer receiving bug
fixes, including for security issues. Python 2.7 went EOL on 2020-01-01
and 3.4 on 2019-03-18. For additional details on support Python
versions, see:

Supported: https://devguide.python.org/#status-of-python-branches
EOL: https://devguide.python.org/devcycle/#end-of-life-branches

Removing support for EOL Pythons will reduce testing and maintenance
resources while allowing the library to move towards modern Python 3.

Using pypinfo, we can show the PyPI download statistics, showing less
than 10% of users are using Python 2.7.

| python_version | percent | download_count |
| -------------- | ------: | -------------: |
| 3.7            |  45.36% |      3,056,010 |
| 3.6            |  26.46% |      1,782,778 |
| 3.8            |  12.22% |        823,213 |
| 2.7            |   9.97% |        671,459 |
| 3.5            |   5.86% |        394,846 |
| 3.4            |   0.10% |          6,700 |
| 3.9            |   0.03% |          2,346 |
| 2.6            |   0.00% |             57 |
| 3.3            |   0.00% |             21 |
| 3.10           |   0.00% |              6 |
| Total          |         |      6,737,436 |

Library users who continue to use Python 2.7 will still be able to
install previous versions of sqlparse.

Compatibility shims have been dropped, simplifying the code.

Using pyupgrade, the codebase has been updated to take advantage of
modern syntax <https://github.com/asottile/pyupgrade>.

The wheel is no longer marked as "universal" as it is now Python 3 only.
2020-08-31 17:27:38 -07:00
Jon Dufresne db4a9f4928 Simply flake8 configuration
W503 is ignored by default.
2020-08-31 17:26:35 -07:00
John Bodley 28a2acdd9b [fix] Adding TypedLiteral to comparison 2020-03-29 19:08:25 +02:00
Andreas Albrecht 6e39e02e38 Switch back to develoment mode. 2020-02-29 14:09:44 +01:00
Andreas Albrecht 58ff890d91 Update Makefile to reflect changes in current twine. 2020-02-29 14:07:43 +01:00
Andreas Albrecht 0d6684baba Update version number for release. 2020-02-29 13:56:13 +01:00
gingi99 33d2ab4c64 add comma_first option for docs 2020-02-02 21:26:26 +01:00
xg1990 3ea4c7eadc put available format options into API doc 2020-02-02 21:25:55 +01:00
Andreas Albrecht 418b04f7e5 Update changelog and authors. 2020-02-02 21:23:49 +01:00
Likai Liu a301b79c04 [grouping] group_as() no longer groups AS CTE
This patch changes the grouping of AS so that:

  Foo AS WITH bar AS 1 SELECT 2

with no longer be grouped as:

  [Identifier[Foo, AS, WITH, Identifier[Bar AS 1]], SELECT, 2]

but will be grouped as:

  [Identifier[Foo], AS, WITH, Identifier[Bar AS 1], SELECT, 2]

This fixes the parsing of CREATE TABLE new_table AS WITH ... so the
rest of the tokens after AS are parsed the same as a bare WITH.
2020-02-02 21:21:09 +01:00
John Bodley 44eacf2e2f [fix] Fixing typed literal regression 2020-02-02 21:19:41 +01:00
John Bodley aaf5403f05 Update sql.py 2020-01-20 19:29:08 +01:00
John Bodley 8f03397ff4 Update sql.py 2020-01-20 19:29:08 +01:00
John Bodley 966a55959c [sql] Adding TIMESTAMP to typed literal 2020-01-20 19:29:08 +01:00
Andreas Albrecht 29166ba54f CI: Remove obsolete comment. 2020-01-16 09:24:01 +01:00
Andreas Albrecht 1e974d080c Update changelog and authors. 2020-01-16 09:22:20 +01:00