Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
6c409fc
Cleanup whitespace in README.
andialbrecht Aug 7, 2022
538eea5
GitHub Actions: Add Py3.10, update Actions, more flake8 tests
cclauss Apr 29, 2022
66e651a
Test on Python 3.11 beta 5
cclauss Aug 4, 2022
83f9058
Reduce max line length in flake8 to the default of 79.
andialbrecht Aug 7, 2022
c504b4a
Update authors and changelog.
andialbrecht Aug 7, 2022
9bf2ec4
Update actions in codeql workflow.
andialbrecht Aug 7, 2022
e58781d
Fix INDICATOR keyword
ptld Jan 17, 2022
402d6e9
docs: Add a PiPY package badge
haoxins Dec 31, 2021
049634a
Acknowledge support for Python 3.10
cclauss Aug 8, 2022
3668799
DIV is Operator
chezou May 4, 2022
4073b56
added some builtin types that can appear in Spark create table statem…
Sep 22, 2021
a3e19f1
Don't make slice copies in TokenList._token_matching().
living180 May 19, 2021
5ab8344
Refactor to reduce redundant code.
living180 May 19, 2021
9d2cb6f
Add regex pattern to identify REGEXP as a Compasion token
PeterSandwich Nov 10, 2021
3d3df9d
Make tzcast grouping function less eager
Aug 16, 2022
507d3cf
Update authors and changelog.
andialbrecht Aug 16, 2022
0bbfd5f
Add DISTINCTROW keyword (fixes #677).
andialbrecht Aug 24, 2022
4862d68
Update Changelog.
andialbrecht Aug 24, 2022
7de1999
CREATE TABLE tbl AS SELECT should return get_alias() for its column
chezou May 3, 2022
a172486
Update Changelog.
andialbrecht Aug 24, 2022
403de6f
Fixed bad parsing of create table statements that use lower case
Sep 19, 2021
893d7b2
Update CHANGELOG.
andialbrecht Aug 24, 2022
c1a597e
add backtick to remove_quotes character list
codenamelxl Jun 11, 2021
e269881
Update Changelog and authors.
andialbrecht Aug 24, 2022
4235eb8
Add tests for utils.remove_quotes.
andialbrecht Aug 24, 2022
07a2e81
Add docstring and comments.
andialbrecht Sep 6, 2022
b72a8ff
Allow any unicode character as identifier name (fixes #641).
andialbrecht Sep 10, 2022
fba15d3
Bump version.
andialbrecht Sep 23, 2022
9f44d54
Switch back to development mode.
andialbrecht Sep 23, 2022
e924194
Revert "add regex pattern to identify IN as a Compasion token"
andialbrecht Dec 30, 2022
24f2990
Update changelog.
andialbrecht Dec 30, 2022
bacbeff
Update workflow runner.
andialbrecht Dec 30, 2022
bf5aff4
Update tested Python versions in workflow.
andialbrecht Dec 30, 2022
243da51
Setup a nightly build, even without changes in the module itself.
andialbrecht Dec 30, 2022
cda0e49
Fix schedule trigger syntax.
andialbrecht Dec 30, 2022
8b789f2
Switch to pyproject.toml (fixes #685).
andialbrecht Dec 30, 2022
9a1cb5d
configurable syntax
mrmasterplan Nov 30, 2022
e37eaea
test configurable syntax
mrmasterplan Nov 30, 2022
8515d2e
remove type annotations for python 3.5 compatibility
mrmasterplan Nov 30, 2022
f9a73a6
test for changing the regex
mrmasterplan Nov 30, 2022
e0d3928
lexer documentation
mrmasterplan Dec 1, 2022
4efdc03
flake8
mrmasterplan Dec 1, 2022
fbf9a57
additional documentation
mrmasterplan Jan 1, 2023
907fb49
change singleton behavior
mrmasterplan Jan 1, 2023
dd9d5b9
Fix get_type with comments between WITH keyword
shikanime Jul 19, 2021
7fdb2da
Merge pull request #633 from shikanime/master
mrmasterplan Jan 5, 2023
fc76056
Cleanup regex for detecting keywords (fixes #709).
andialbrecht Mar 20, 2023
b949fdf
CI: Use codecov action.
andialbrecht Apr 14, 2023
c457abd
Remove unnecessary parts in regex for bad escaping.
andialbrecht Mar 20, 2023
64bb91f
Testing branch
Kwstubbs Mar 22, 2023
d9d69f4
Removed test file
Kwstubbs Mar 22, 2023
58dae6f
Bump version.
andialbrecht Apr 18, 2023
647d145
Update Changelog.
andialbrecht Apr 18, 2023
bd417b8
Switch back to development mode.
andialbrecht Apr 18, 2023
34c7c4d
Update python-app.yml: Try with 3.12-beta1
andialbrecht Jun 3, 2023
3c4b57c
Update python-app.yml: Revert to 3.12-dev and add check-latest
andialbrecht Jun 3, 2023
8157d16
Add classifier for Python 3.11 (fixes #726).
andialbrecht Jul 5, 2023
9765fce
Remove outdated and unused editorconfig.
andialbrecht Jul 23, 2023
2bc8d9c
Drop support for Python 3.5.
andialbrecht Jul 24, 2023
be35807
Get tox running again.
andialbrecht Jul 24, 2023
3eec63d
Don't pin virtualenv in dev section.
andialbrecht Jul 24, 2023
b90e422
Add reminder for github release (fixes #732).
andialbrecht Aug 6, 2023
d69fada
Update issue templates
andialbrecht Aug 6, 2023
efcdbf6
Update bug_report.md
andialbrecht Aug 6, 2023
bcfbe37
Add link to discussion when creating issues.
andialbrecht Aug 6, 2023
8aa4715
Update config.yml.
andialbrecht Aug 6, 2023
9a90474
Update test action.
andialbrecht Aug 6, 2023
0623627
Add Code of Conduct.
andialbrecht Aug 6, 2023
bb42969
Add contributing guide.
andialbrecht Aug 6, 2023
c0ffe86
Create SECURITY.md
andialbrecht Aug 6, 2023
881db0b
Add Pull request template.
andialbrecht Aug 6, 2023
715feac
Update Python version in test action.
andialbrecht Aug 7, 2023
baf3a0a
Updated too early... switching back to 3.12.0-beta.4.
andialbrecht Aug 7, 2023
21f9fd5
CI: Try to fix importlib issue with flake8.
andialbrecht Sep 4, 2023
c0a8ee6
Bump GitHub Actions
hugovk Sep 9, 2023
9bf512c
Add support for Python 3.12
hugovk Sep 9, 2023
8ce446e
Update changelog and authors.
andialbrecht Sep 19, 2023
fac38cd
Ignore attributes starting with dunder in _TokenType (fixes #672).
andialbrecht Sep 19, 2023
5c94352
Simplify regex.
andialbrecht Sep 19, 2023
3696d53
Code cleanup.
andialbrecht Sep 19, 2023
9d22d91
Merge remote-tracking branch 'upstream/master'
dylanscott Sep 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .editorconfig

This file was deleted.

7 changes: 7 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Be nice to each other

Everyone participating in the _sqlparse_ project and especially in the
issue tracker, discussion forums, pull requests, is expected to treat
other people with respect and more generally to follow the guidelines
articulated in the
[Python Community Code of Conduct](https://www.python.org/psf/codeofconduct/).
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug,needs-triage'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior.
Please give code examples or concete SQL statements. Take care of not posting any sensitive information when pasting SQL statements!
What's the concrete error / traceback.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Versions (please complete the following information):**
- Python: [e.g. 3.11.2]
- sqlparse: [e.g. 0.4.1]

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Discussions, Questions?
url: https://github.com/andialbrecht/sqlparse/discussions
about: Please ask questions and start more general discussions here
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Thanks for contributing!

Before submitting your pull request please have a look at the
following checklist:

- [ ] ran the tests (`pytest`)
- [ ] all style issues addressed (`flake8`)
- [ ] your changes are covered by tests
- [ ] your changes are documented, if needed

In addition, please take care to provide a proper description
on what your change does, fixes or achieves when submitting the
pull request.
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -54,7 +54,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,4 +68,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
50 changes: 29 additions & 21 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,46 @@ name: Python application

on:
push:
branches: [ master ]
branches:
- master
pull_request:
branches: [ master ]
schedule:
- cron: '0 12 * * *'

jobs:
build:

runs-on: ubuntu-latest
test:
name: Run tests on ${{ matrix.py }}
runs-on: ubuntu-20.04 # keep it on 20.04 to have Python 3.6 available
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
py:
- "3.12"
- "3.11"
- "3.10"
- "3.9"
- "3.8"
- "3.7"
- "3.6"
- "pypy-3.9"
- "pypy-3.8"
- "pypy-3.7"

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.py }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.py }}
allow-prereleases: true
check-latest: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov codecov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install --upgrade pip flit
flit install --deps=develop
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 sqlparse --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 sqlparse --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
run: flake8 sqlparse --count --max-complexity=31 --show-source --statistics
- name: Test with pytest
run: |
pytest --cov=sqlparse
run: pytest --cov=sqlparse
- name: Publish to codecov
run: |
codecov
uses: codecov/codecov-action@v3
9 changes: 9 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ project: https://bitbucket.org/gutworth/six.

Alphabetical list of contributors:
* Adam Greenhall <agreenhall@lyft.com>
* Aki Ariga <chezou+github@gmail.com>
* Alexander Beedie <ayembee@gmail.com>
* Alexey Malyshev <nostrict@gmail.com>
* ali-tny <aliteeney@googlemail.com>
Expand All @@ -16,20 +17,25 @@ Alphabetical list of contributors:
* atronah <atronah.ds@gmail.com>
* casey <casey@cloudera.com>
* Cauê Beloni <cbeloni@gmail.com>
* Christian Clauss <cclauss@me.com>
* circld <circld1@gmail.com>
* Corey Zumar <corey.zumar@databricks.com>
* Cristian Orellana <cristiano@groupon.com>
* Dag Wieers <dag@wieers.com>
* Daniel Harding <dharding@living180.net>
* Darik Gamble <darik.gamble@gmail.com>
* Demetrio92 <Demetrio.Rodriguez.T@gmail.com>
* Dennis Taylor <dennis.taylor@clio.com>
* Dvořák Václav <Vaclav.Dvorak@ysoft.com>
* Erik Cederstrand <erik@adamatics.com>
* Florian Bauer <florian.bauer@zmdi.com>
* Fredy Wijaya <fredy.wijaya@gmail.com>
* Gavin Wahl <gwahl@fusionbox.com>
* Hugo van Kemenade <hugovk@users.noreply.github.com>
* hurcy <cinyoung.hur@gmail.com>
* Ian Robertson <ian.robertson@capitalone.com>
* JacekPliszka <Jacek.Pliszka@gmail.com>
* JavierPan <PeterSandwich@users.noreply.github.com>
* Jean-Martin Archer <jm@jmartin.ca>
* Jesús Leganés Combarro "Piranna" <piranna@gmail.com>
* Johannes Hoff <johshoff@gmail.com>
Expand All @@ -39,11 +45,13 @@ Alphabetical list of contributors:
* Kevin Jing Qiu <kevin.jing.qiu@gmail.com>
* koljonen <koljonen@outlook.com>
* Likai Liu <liulk@likai.org>
* Long Le Xich <codenamelxl@users.noreply.github.com>
* mathilde.oustlant <mathilde.oustlant@ext.cdiscount.com>
* Michael Schuller <chick@mschuller.net>
* Mike Amy <cocoade@googlemail.com>
* mulos <daniel.strackbein@gmail.com>
* Oleg Broytman <phd@phdru.name>
* osmnv <80402144+osmnv@users.noreply.github.com>
* Patrick Schemitz <patrick.schemitz@digitalbriefkasten.de>
* Pi Delport <pjdelport@gmail.com>
* Prudhvi Vatala <pvatala@gmail.com>
Expand All @@ -55,6 +63,7 @@ Alphabetical list of contributors:
* Ryan Wooden <rygwdn@gmail.com>
* saaj <id@saaj.me>
* Shen Longxing <shenlongxing2012@gmail.com>
* Simon Heisterkamp <she@delegate.dk>
* Sjoerd Job Postmus
* Soloman Weng <soloman1124@gmail.com>
* spigwitmer <itgpmc@gmail.com>
Expand Down
59 changes: 58 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,64 @@
Development Version
-------------------

Nothing yet.
Notable Changes

* Drop support for Python 3.5.
* Python 3.12 is now supported (pr725, by hugovk).

Bug Fixes

* Ignore dunder attributes when creating Tokens (issue672).


Release 0.4.4 (Apr 18, 2023)
----------------------------

Notable Changes

* IMPORTANT: This release fixes a security vulnerability in the
parser where a regular expression vulnerable to ReDOS (Regular
Expression Denial of Service) was used. See the security advisory
for details: https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-rrm6-wvj7-cwh2
The vulnerability was discovered by @erik-krogh from GitHub
Security Lab (GHSL). Thanks for reporting!

Bug Fixes

* Revert a change from 0.4.0 that changed IN to be a comparison (issue694).
The primary expectation is that IN is treated as a keyword and not as a
comparison operator. That also follows the definition of reserved keywords
for the major SQL syntax definitions.
* Fix regular expressions for string parsing.

Other

* sqlparse now uses pyproject.toml instead of setup.cfg (issue685).


Release 0.4.3 (Sep 23, 2022)
----------------------------

Enhancements

* Add support for DIV operator (pr664, by chezou).
* Add support for additional SPARK keywords (pr643, by mrmasterplan).
* Avoid tokens copy (pr622, by living180).
* Add REGEXP as a comparision (pr647, by PeterSandwich).
* Add DISTINCTROW keyword for MS Access (issue677).
* Improve parsing of CREATE TABLE AS SELECT (pr662, by chezou).

Bug Fixes

* Fix spelling of INDICATOR keyword (pr653, by ptld).
* Fix formatting error in EXTRACT function (issue562, issue670, pr676, by ecederstrand).
* Fix bad parsing of create table statements that use lower case (issue217, pr642, by mrmasterplan).
* Handle backtick as valid quote char (issue628, pr629, by codenamelxl).
* Allow any unicode character as valid identifier name (issue641).

Other

* Update github actions to test on Python 3.10 as well (pr661, by cclaus).


Release 0.4.2 (Sep 10, 2021)
Expand Down
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Contributing to `sqlparse`

Thanks for your interest in contributing to the `sqlparse` project!

All contributors are expected to follow the
[Python Community Code of Conduct](https://www.python.org/psf/codeofconduct/).

Head over to the
[Discussions Page](https://github.com/andialbrecht/sqlparse/discussions) if
you have any questions. We're still working on a more elaborate
developer guide.
11 changes: 0 additions & 11 deletions MANIFEST.in

This file was deleted.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ clean:

release:
@rm -rf dist/
python setup.py sdist bdist_wheel
python -m build
twine upload --sign --identity E0B84F81 dist/*
@echo "Reminder: Add release on github https://github.com/andialbrecht/sqlparse/releases"
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ python-sqlparse - Parse SQL statements
|buildstatus|_
|coverage|_
|docs|_
|packageversion|_

.. docincludebegin

sqlparse is a non-validating SQL parser for Python.
It provides support for parsing, splitting and formatting SQL statements.

The module is compatible with Python 3.5+ and released under the terms of the
The module is compatible with Python 3.6+ and released under the terms of the
`New BSD license <https://opensource.org/licenses/BSD-3-Clause>`_.

Visit the project page at https://github.com/andialbrecht/sqlparse for
Expand Down Expand Up @@ -59,7 +60,7 @@ Documentation
https://sqlparse.readthedocs.io/

Online Demo
https://sqlformat.org/
https://sqlformat.org/


sqlparse is licensed under the BSD license.
Expand All @@ -73,3 +74,5 @@ pygments-Homepage: http://pygments.org/
.. _coverage: https://codecov.io/gh/andialbrecht/sqlparse
.. |docs| image:: https://readthedocs.org/projects/sqlparse/badge/?version=latest
.. _docs: https://sqlparse.readthedocs.io/en/latest/?badge=latest
.. |packageversion| image:: https://img.shields.io/pypi/v/sqlparse?color=%2334D058&label=pypi%20package
.. _packageversion: https://pypi.org/project/sqlparse
14 changes: 14 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Security Policy

## Supported Versions

For now `sqlparse` uses very defensive version numbers. There's no major version yet.
In turn there's only one supported version and this is the latest.

## Reporting a Vulnerability

To report a vulnerability head over to the [Security Advisories](https://github.com/andialbrecht/sqlparse/security/advisories)
page and click on "New draft security advisory".

Feel free to contact me at albrecht.andi@gmail.com if you have any questions or want to discuss things
beforehand.
Loading