Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-sqlparse for openSUSE:Factory checked in at 2022-10-04 20:37:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-sqlparse (Old) and /work/SRC/openSUSE:Factory/.python-sqlparse.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-sqlparse" Tue Oct 4 20:37:14 2022 rev:14 rq:1007717 version:0.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-sqlparse/python-sqlparse.changes 2021-10-20 20:23:49.585361117 +0200 +++ /work/SRC/openSUSE:Factory/.python-sqlparse.new.2275/python-sqlparse.changes 2022-10-04 20:37:15.852876933 +0200 @@ -1,0 +2,16 @@ +Mon Oct 3 16:01:20 UTC 2022 - Dirk M??ller <dmuel...@suse.com> + +- update to 0.4.3: + * Add support for DIV operator. + * Add support for additional SPARK keywords. + * Avoid tokens copy. + * Add REGEXP as a comparision. + * Add DISTINCTROW keyword for MS Access. + * Improve parsing of CREATE TABLE AS SELECT. + * Fix spelling of INDICATOR keyword. + * Fix formatting error in EXTRACT function. + * Fix bad parsing of create table statements that use lower case. + * Handle backtick as valid quote char. + * Allow any unicode character as valid identifier name. + +------------------------------------------------------------------- Old: ---- sqlparse-0.4.2.tar.gz New: ---- sqlparse-0.4.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-sqlparse.spec ++++++ --- /var/tmp/diff_new_pack.eQsn0X/_old 2022-10-04 20:37:16.432877757 +0200 +++ /var/tmp/diff_new_pack.eQsn0X/_new 2022-10-04 20:37:16.436877763 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-sqlparse # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-sqlparse -Version: 0.4.2 +Version: 0.4.3 Release: 0 Summary: Non-validating SQL parser License: BSD-3-Clause ++++++ sqlparse-0.4.2.tar.gz -> sqlparse-0.4.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/AUTHORS new/sqlparse-0.4.3/AUTHORS --- old/sqlparse-0.4.2/AUTHORS 2020-12-12 09:28:18.000000000 +0100 +++ new/sqlparse-0.4.3/AUTHORS 2022-09-06 21:32:40.000000000 +0200 @@ -8,6 +8,7 @@ Alphabetical list of contributors: * Adam Greenhall <agreenh...@lyft.com> +* Aki Ariga <chezou+git...@gmail.com> * Alexander Beedie <ayem...@gmail.com> * Alexey Malyshev <nostr...@gmail.com> * ali-tny <alitee...@googlemail.com> @@ -16,20 +17,24 @@ * atronah <atronah...@gmail.com> * casey <ca...@cloudera.com> * Cau?? Beloni <cbel...@gmail.com> +* Christian Clauss <ccla...@me.com> * circld <circ...@gmail.com> * Corey Zumar <corey.zu...@databricks.com> * Cristian Orellana <cristi...@groupon.com> * Dag Wieers <d...@wieers.com> +* Daniel Harding <dhard...@living180.net> * Darik Gamble <darik.gam...@gmail.com> * Demetrio92 <demetrio.rodrigue...@gmail.com> * Dennis Taylor <dennis.tay...@clio.com> * Dvo????k V??clav <vaclav.dvo...@ysoft.com> +* Erik Cederstrand <e...@adamatics.com> * Florian Bauer <florian.ba...@zmdi.com> * Fredy Wijaya <fredy.wij...@gmail.com> * Gavin Wahl <gw...@fusionbox.com> * hurcy <cinyoung....@gmail.com> * Ian Robertson <ian.robert...@capitalone.com> * JacekPliszka <jacek.plis...@gmail.com> +* JavierPan <petersandw...@users.noreply.github.com> * Jean-Martin Archer <j...@jmartin.ca> * Jes??s Legan??s Combarro "Piranna" <pira...@gmail.com> * Johannes Hoff <johsh...@gmail.com> @@ -39,11 +44,13 @@ * Kevin Jing Qiu <kevin.jing....@gmail.com> * koljonen <koljo...@outlook.com> * Likai Liu <li...@likai.org> +* Long Le Xich <codename...@users.noreply.github.com> * mathilde.oustlant <mathilde.oustl...@ext.cdiscount.com> * Michael Schuller <ch...@mschuller.net> * Mike Amy <coco...@googlemail.com> * mulos <daniel.strackb...@gmail.com> * Oleg Broytman <p...@phdru.name> +* osmnv <80402144+os...@users.noreply.github.com> * Patrick Schemitz <patrick.schem...@digitalbriefkasten.de> * Pi Delport <pjdelp...@gmail.com> * Prudhvi Vatala <pvat...@gmail.com> @@ -55,6 +62,7 @@ * Ryan Wooden <ryg...@gmail.com> * saaj <i...@saaj.me> * Shen Longxing <shenlongxing2...@gmail.com> +* Simon Heisterkamp <s...@delegate.dk> * Sjoerd Job Postmus * Soloman Weng <soloman1...@gmail.com> * spigwitmer <itg...@gmail.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/CHANGELOG new/sqlparse-0.4.3/CHANGELOG --- old/sqlparse-0.4.2/CHANGELOG 2021-09-10 08:50:44.000000000 +0200 +++ new/sqlparse-0.4.3/CHANGELOG 2022-09-23 20:30:49.000000000 +0200 @@ -1,3 +1,28 @@ +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) ---------------------------- @@ -78,7 +103,7 @@ * Remove support for parsing double slash comments introduced in 0.3.0 (issue456) as it had some side-effects with other dialects and doesn't seem to be widely used (issue476). -* Restrict detection of alias names to objects that acutally could +* Restrict detection of alias names to objects that actually could have an alias (issue455, adopted some parts of pr509 by john-bodley). * Fix parsing of date/time literals (issue438, by vashek). * Fix initialization of TokenList (issue499, pr505 by john-bodley). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/PKG-INFO new/sqlparse-0.4.3/PKG-INFO --- old/sqlparse-0.4.2/PKG-INFO 2021-09-10 08:51:15.000000000 +0200 +++ new/sqlparse-0.4.3/PKG-INFO 2022-09-23 20:40:44.459821500 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: sqlparse -Version: 0.4.2 +Version: 0.4.3 Summary: A non-validating SQL parser. Home-page: https://github.com/andialbrecht/sqlparse Author: Andi Albrecht @@ -10,83 +10,6 @@ Project-URL: Release Notes, https://sqlparse.readthedocs.io/en/latest/changes/ Project-URL: Source, https://github.com/andialbrecht/sqlparse Project-URL: Tracker, https://github.com/andialbrecht/sqlparse/issues -Description: python-sqlparse - Parse SQL statements - ====================================== - - |buildstatus|_ - |coverage|_ - |docs|_ - - .. 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 - `New BSD license <https://opensource.org/licenses/BSD-3-Clause>`_. - - Visit the project page at https://github.com/andialbrecht/sqlparse for - further information about this project. - - - Quick Start - ----------- - - .. code-block:: sh - - $ pip install sqlparse - - .. code-block:: python - - >>> import sqlparse - - >>> # Split a string containing two SQL statements: - >>> raw = 'select * from foo; select * from bar;' - >>> statements = sqlparse.split(raw) - >>> statements - ['select * from foo;', 'select * from bar;'] - - >>> # Format the first statement and print it out: - >>> first = statements[0] - >>> print(sqlparse.format(first, reindent=True, keyword_case='upper')) - SELECT * - FROM foo; - - >>> # Parsing a SQL statement: - >>> parsed = sqlparse.parse('select * from foo')[0] - >>> parsed.tokens - [<DML 'select' at 0x7f22c5e15368>, <Whitespace ' ' at 0x7f22c5e153b0>, <Wildcard '*' ??? ] - >>> - - Links - ----- - - Project page - https://github.com/andialbrecht/sqlparse - - Bug tracker - https://github.com/andialbrecht/sqlparse/issues - - Documentation - https://sqlparse.readthedocs.io/ - - Online Demo - https://sqlformat.org/ - - - sqlparse is licensed under the BSD license. - - Parts of the code are based on pygments written by Georg Brandl and others. - pygments-Homepage: http://pygments.org/ - - .. |buildstatus| image:: https://secure.travis-ci.org/andialbrecht/sqlparse.png?branch=master - .. _buildstatus: https://travis-ci.org/#!/andialbrecht/sqlparse - .. |coverage| image:: https://codecov.io/gh/andialbrecht/sqlparse/branch/master/graph/badge.svg - .. _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 - -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License @@ -99,8 +22,90 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Database Classifier: Topic :: Software Development Requires-Python: >=3.5 +License-File: LICENSE +License-File: AUTHORS + +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 +`New BSD license <https://opensource.org/licenses/BSD-3-Clause>`_. + +Visit the project page at https://github.com/andialbrecht/sqlparse for +further information about this project. + + +Quick Start +----------- + +.. code-block:: sh + + $ pip install sqlparse + +.. code-block:: python + + >>> import sqlparse + + >>> # Split a string containing two SQL statements: + >>> raw = 'select * from foo; select * from bar;' + >>> statements = sqlparse.split(raw) + >>> statements + ['select * from foo;', 'select * from bar;'] + + >>> # Format the first statement and print it out: + >>> first = statements[0] + >>> print(sqlparse.format(first, reindent=True, keyword_case='upper')) + SELECT * + FROM foo; + + >>> # Parsing a SQL statement: + >>> parsed = sqlparse.parse('select * from foo')[0] + >>> parsed.tokens + [<DML 'select' at 0x7f22c5e15368>, <Whitespace ' ' at 0x7f22c5e153b0>, <Wildcard '*' ??? ] + >>> + +Links +----- + +Project page + https://github.com/andialbrecht/sqlparse + +Bug tracker + https://github.com/andialbrecht/sqlparse/issues + +Documentation + https://sqlparse.readthedocs.io/ + +Online Demo + https://sqlformat.org/ + + +sqlparse is licensed under the BSD license. + +Parts of the code are based on pygments written by Georg Brandl and others. +pygments-Homepage: http://pygments.org/ + +.. |buildstatus| image:: https://github.com/andialbrecht/sqlparse/actions/workflows/python-app.yml/badge.svg +.. _buildstatus: https://github.com/andialbrecht/sqlparse/actions/workflows/python-app.yml +.. |coverage| image:: https://codecov.io/gh/andialbrecht/sqlparse/branch/master/graph/badge.svg +.. _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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/README.rst new/sqlparse-0.4.3/README.rst --- old/sqlparse-0.4.2/README.rst 2020-09-30 15:44:45.000000000 +0200 +++ new/sqlparse-0.4.3/README.rst 2022-09-06 21:32:40.000000000 +0200 @@ -4,6 +4,7 @@ |buildstatus|_ |coverage|_ |docs|_ +|packageversion|_ .. docincludebegin @@ -59,7 +60,7 @@ https://sqlparse.readthedocs.io/ Online Demo - https://sqlformat.org/ + https://sqlformat.org/ sqlparse is licensed under the BSD license. @@ -67,9 +68,11 @@ Parts of the code are based on pygments written by Georg Brandl and others. pygments-Homepage: http://pygments.org/ -.. |buildstatus| image:: https://secure.travis-ci.org/andialbrecht/sqlparse.png?branch=master -.. _buildstatus: https://travis-ci.org/#!/andialbrecht/sqlparse +.. |buildstatus| image:: https://github.com/andialbrecht/sqlparse/actions/workflows/python-app.yml/badge.svg +.. _buildstatus: https://github.com/andialbrecht/sqlparse/actions/workflows/python-app.yml .. |coverage| image:: https://codecov.io/gh/andialbrecht/sqlparse/branch/master/graph/badge.svg .. _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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/setup.cfg new/sqlparse-0.4.3/setup.cfg --- old/sqlparse-0.4.2/setup.cfg 2021-09-10 08:51:15.000000000 +0200 +++ new/sqlparse-0.4.3/setup.cfg 2022-09-23 20:40:44.461999000 +0200 @@ -20,6 +20,7 @@ Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy Topic :: Database diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/sqlparse/__init__.py new/sqlparse-0.4.3/sqlparse/__init__.py --- old/sqlparse-0.4.2/sqlparse/__init__.py 2021-09-10 08:50:06.000000000 +0200 +++ new/sqlparse-0.4.3/sqlparse/__init__.py 2022-09-23 20:29:53.000000000 +0200 @@ -16,7 +16,7 @@ from sqlparse import formatter -__version__ = '0.4.2' +__version__ = '0.4.3' __all__ = ['engine', 'filters', 'formatter', 'sql', 'tokens', 'cli'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/sqlparse/engine/grouping.py new/sqlparse-0.4.3/sqlparse/engine/grouping.py --- old/sqlparse-0.4.2/sqlparse/engine/grouping.py 2020-10-07 08:52:56.000000000 +0200 +++ new/sqlparse-0.4.3/sqlparse/engine/grouping.py 2022-09-06 21:32:40.000000000 +0200 @@ -91,13 +91,20 @@ def match(token): return token.ttype == T.Keyword.TZCast - def valid(token): + def valid_prev(token): return token is not None + def valid_next(token): + return token is not None and ( + token.is_whitespace + or token.match(T.Keyword, 'AS') + or token.match(*sql.TypedLiteral.M_CLOSE) + ) + def post(tlist, pidx, tidx, nidx): return pidx, nidx - _group(tlist, sql.Identifier, match, valid, valid, post) + _group(tlist, sql.Identifier, match, valid_prev, valid_next, post) def group_typed_literal(tlist): @@ -334,12 +341,15 @@ def group_functions(tlist): has_create = False has_table = False + has_as = False for tmp_token in tlist.tokens: - if tmp_token.value == 'CREATE': + if tmp_token.value.upper() == 'CREATE': has_create = True - if tmp_token.value == 'TABLE': + if tmp_token.value.upper() == 'TABLE': has_table = True - if has_create and has_table: + if tmp_token.value == 'AS': + has_as = True + if has_create and has_table and not has_as: return tidx, token = tlist.token_next_by(t=T.Name) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/sqlparse/keywords.py new/sqlparse-0.4.3/sqlparse/keywords.py --- old/sqlparse-0.4.2/sqlparse/keywords.py 2021-07-14 15:55:03.000000000 +0200 +++ new/sqlparse-0.4.3/sqlparse/keywords.py 2022-09-10 10:36:58.000000000 +0200 @@ -11,11 +11,17 @@ def is_keyword(value): + """Checks for a keyword. + + If the given value is in one of the KEYWORDS_* dictionary + it's considered a keyword. Otherwise tokens.Name is returned. + """ val = value.upper() return (KEYWORDS_COMMON.get(val) or KEYWORDS_ORACLE.get(val) or KEYWORDS_PLPGSQL.get(val) or KEYWORDS_HQL.get(val) + or KEYWORDS_MSACCESS.get(val) or KEYWORDS.get(val, tokens.Name)), value @@ -56,7 +62,7 @@ # see issue #39 # Spaces around period `schema . name` are valid identifier # TODO: Spaces before period not implemented - (r'[A-Z??-??]\w*(?=\s*\.)', tokens.Name), # 'Name' . + (r'[A-Z??-??]\w*(?=\s*\.)', tokens.Name), # 'Name'. # FIXME(atronah): never match, # because `re.match` doesn't work with look-behind regexp feature (r'(?<=\.)[A-Z??-??]\w*', tokens.Name), # .'Name' @@ -90,7 +96,10 @@ tokens.Keyword), (r"(AT|WITH')\s+TIME\s+ZONE\s+'[^']+'", tokens.Keyword.TZCast), (r'(NOT\s+)?(LIKE|ILIKE|RLIKE)\b', tokens.Operator.Comparison), - (r'[0-9_A-Z??-??][_$#\w]*', is_keyword), + (r'(NOT\s+)?(REGEXP)\b', tokens.Operator.Comparison), + # Check for keywords, also returns tokens.Name if regex matches + # but the match isn't a keyword. + (r'[0-9_\w][_$#\w]*', is_keyword), (r'[;:()\[\],\.]', tokens.Punctuation), (r'[<>=~!]+', tokens.Operator.Comparison), (r'[+/@#%^&|^-]+', tokens.Operator), @@ -241,6 +250,7 @@ 'DISABLE': tokens.Keyword, 'DISCONNECT': tokens.Keyword, 'DISPATCH': tokens.Keyword, + 'DIV': tokens.Operator, 'DO': tokens.Keyword, 'DOMAIN': tokens.Keyword, 'DYNAMIC': tokens.Keyword, @@ -314,7 +324,7 @@ 'INCREMENT': tokens.Keyword, 'INDEX': tokens.Keyword, - 'INDITCATOR': tokens.Keyword, + 'INDICATOR': tokens.Keyword, 'INFIX': tokens.Keyword, 'INHERITS': tokens.Keyword, 'INITIAL': tokens.Keyword, @@ -907,6 +917,7 @@ 'INLINE': tokens.Keyword, 'INSTR': tokens.Keyword, 'LEN': tokens.Keyword, + 'MAP': tokens.Name.Builtin, 'MAXELEMENT': tokens.Keyword, 'MAXINDEX': tokens.Keyword, 'MAX_PART_DATE': tokens.Keyword, @@ -938,9 +949,12 @@ 'SQRT': tokens.Keyword, 'STACK': tokens.Keyword, 'STR': tokens.Keyword, + 'STRING': tokens.Name.Builtin, + 'STRUCT': tokens.Name.Builtin, 'SUBSTR': tokens.Keyword, 'SUMMARY': tokens.Keyword, 'TBLPROPERTIES': tokens.Keyword, + 'TIMESTAMP': tokens.Name.Builtin, 'TIMESTAMP_ISO': tokens.Keyword, 'TO_CHAR': tokens.Keyword, 'TO_DATE': tokens.Keyword, @@ -956,3 +970,8 @@ 'BREAK': tokens.Keyword, 'LEAVE': tokens.Keyword, } + + +KEYWORDS_MSACCESS = { + 'DISTINCTROW': tokens.Keyword, +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/sqlparse/sql.py new/sqlparse-0.4.3/sqlparse/sql.py --- old/sqlparse-0.4.2/sqlparse/sql.py 2020-10-07 08:52:52.000000000 +0200 +++ new/sqlparse-0.4.3/sqlparse/sql.py 2022-09-06 21:32:40.000000000 +0200 @@ -234,16 +234,16 @@ if reverse: assert end is None - for idx in range(start - 2, -1, -1): - token = self.tokens[idx] - for func in funcs: - if func(token): - return idx, token + indexes = range(start - 2, -1, -1) else: - for idx, token in enumerate(self.tokens[start:end], start=start): - for func in funcs: - if func(token): - return idx, token + if end is None: + end = len(self.tokens) + indexes = range(start, end) + for idx in indexes: + token = self.tokens[idx] + for func in funcs: + if func(token): + return idx, token return None, None def token_first(self, skip_ws=True, skip_cm=False): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/sqlparse/utils.py new/sqlparse-0.4.3/sqlparse/utils.py --- old/sqlparse-0.4.2/sqlparse/utils.py 2020-10-07 08:53:00.000000000 +0200 +++ new/sqlparse-0.4.3/sqlparse/utils.py 2022-09-06 21:32:40.000000000 +0200 @@ -55,7 +55,7 @@ """Helper that removes surrounding quotes from strings.""" if val is None: return - if val[0] in ('"', "'") and val[0] == val[-1]: + if val[0] in ('"', "'", '`') and val[0] == val[-1]: val = val[1:-1] return val diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/sqlparse.egg-info/PKG-INFO new/sqlparse-0.4.3/sqlparse.egg-info/PKG-INFO --- old/sqlparse-0.4.2/sqlparse.egg-info/PKG-INFO 2021-09-10 08:51:14.000000000 +0200 +++ new/sqlparse-0.4.3/sqlparse.egg-info/PKG-INFO 2022-09-23 20:40:44.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: sqlparse -Version: 0.4.2 +Version: 0.4.3 Summary: A non-validating SQL parser. Home-page: https://github.com/andialbrecht/sqlparse Author: Andi Albrecht @@ -10,83 +10,6 @@ Project-URL: Release Notes, https://sqlparse.readthedocs.io/en/latest/changes/ Project-URL: Source, https://github.com/andialbrecht/sqlparse Project-URL: Tracker, https://github.com/andialbrecht/sqlparse/issues -Description: python-sqlparse - Parse SQL statements - ====================================== - - |buildstatus|_ - |coverage|_ - |docs|_ - - .. 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 - `New BSD license <https://opensource.org/licenses/BSD-3-Clause>`_. - - Visit the project page at https://github.com/andialbrecht/sqlparse for - further information about this project. - - - Quick Start - ----------- - - .. code-block:: sh - - $ pip install sqlparse - - .. code-block:: python - - >>> import sqlparse - - >>> # Split a string containing two SQL statements: - >>> raw = 'select * from foo; select * from bar;' - >>> statements = sqlparse.split(raw) - >>> statements - ['select * from foo;', 'select * from bar;'] - - >>> # Format the first statement and print it out: - >>> first = statements[0] - >>> print(sqlparse.format(first, reindent=True, keyword_case='upper')) - SELECT * - FROM foo; - - >>> # Parsing a SQL statement: - >>> parsed = sqlparse.parse('select * from foo')[0] - >>> parsed.tokens - [<DML 'select' at 0x7f22c5e15368>, <Whitespace ' ' at 0x7f22c5e153b0>, <Wildcard '*' ??? ] - >>> - - Links - ----- - - Project page - https://github.com/andialbrecht/sqlparse - - Bug tracker - https://github.com/andialbrecht/sqlparse/issues - - Documentation - https://sqlparse.readthedocs.io/ - - Online Demo - https://sqlformat.org/ - - - sqlparse is licensed under the BSD license. - - Parts of the code are based on pygments written by Georg Brandl and others. - pygments-Homepage: http://pygments.org/ - - .. |buildstatus| image:: https://secure.travis-ci.org/andialbrecht/sqlparse.png?branch=master - .. _buildstatus: https://travis-ci.org/#!/andialbrecht/sqlparse - .. |coverage| image:: https://codecov.io/gh/andialbrecht/sqlparse/branch/master/graph/badge.svg - .. _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 - -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License @@ -99,8 +22,90 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Database Classifier: Topic :: Software Development Requires-Python: >=3.5 +License-File: LICENSE +License-File: AUTHORS + +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 +`New BSD license <https://opensource.org/licenses/BSD-3-Clause>`_. + +Visit the project page at https://github.com/andialbrecht/sqlparse for +further information about this project. + + +Quick Start +----------- + +.. code-block:: sh + + $ pip install sqlparse + +.. code-block:: python + + >>> import sqlparse + + >>> # Split a string containing two SQL statements: + >>> raw = 'select * from foo; select * from bar;' + >>> statements = sqlparse.split(raw) + >>> statements + ['select * from foo;', 'select * from bar;'] + + >>> # Format the first statement and print it out: + >>> first = statements[0] + >>> print(sqlparse.format(first, reindent=True, keyword_case='upper')) + SELECT * + FROM foo; + + >>> # Parsing a SQL statement: + >>> parsed = sqlparse.parse('select * from foo')[0] + >>> parsed.tokens + [<DML 'select' at 0x7f22c5e15368>, <Whitespace ' ' at 0x7f22c5e153b0>, <Wildcard '*' ??? ] + >>> + +Links +----- + +Project page + https://github.com/andialbrecht/sqlparse + +Bug tracker + https://github.com/andialbrecht/sqlparse/issues + +Documentation + https://sqlparse.readthedocs.io/ + +Online Demo + https://sqlformat.org/ + + +sqlparse is licensed under the BSD license. + +Parts of the code are based on pygments written by Georg Brandl and others. +pygments-Homepage: http://pygments.org/ + +.. |buildstatus| image:: https://github.com/andialbrecht/sqlparse/actions/workflows/python-app.yml/badge.svg +.. _buildstatus: https://github.com/andialbrecht/sqlparse/actions/workflows/python-app.yml +.. |coverage| image:: https://codecov.io/gh/andialbrecht/sqlparse/branch/master/graph/badge.svg +.. _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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/sqlparse.egg-info/SOURCES.txt new/sqlparse-0.4.3/sqlparse.egg-info/SOURCES.txt --- old/sqlparse-0.4.2/sqlparse.egg-info/SOURCES.txt 2021-09-10 08:51:14.000000000 +0200 +++ new/sqlparse-0.4.3/sqlparse.egg-info/SOURCES.txt 2022-09-23 20:40:44.000000000 +0200 @@ -55,6 +55,7 @@ tests/test_regressions.py tests/test_split.py tests/test_tokenize.py +tests/test_utils.py tests/files/_Make_DirEntry.sql tests/files/begintag.sql tests/files/begintag_2.sql diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/sqlparse.egg-info/entry_points.txt new/sqlparse-0.4.3/sqlparse.egg-info/entry_points.txt --- old/sqlparse-0.4.2/sqlparse.egg-info/entry_points.txt 2021-09-10 08:51:14.000000000 +0200 +++ new/sqlparse-0.4.3/sqlparse.egg-info/entry_points.txt 2022-09-23 20:40:44.000000000 +0200 @@ -1,3 +1,2 @@ [console_scripts] sqlformat = sqlparse.__main__:main - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/tests/test_grouping.py new/sqlparse-0.4.3/tests/test_grouping.py --- old/sqlparse-0.4.2/tests/test_grouping.py 2020-09-30 15:44:45.000000000 +0200 +++ new/sqlparse-0.4.3/tests/test_grouping.py 2022-09-06 21:32:40.000000000 +0200 @@ -324,6 +324,11 @@ assert p.tokens[0].get_alias() == 'foo' +def test_grouping_alias_ctas(): + p = sqlparse.parse('CREATE TABLE tbl1 AS SELECT coalesce(t1.col1, 0) AS col1 FROM t1')[0] + assert p.tokens[10].get_alias() == 'col1' + assert isinstance(p.tokens[10].tokens[0], sql.Function) + def test_grouping_subquery_no_parens(): # Not totally sure if this is the right approach... # When a THEN clause contains a subquery w/o parenthesis around it *and* @@ -655,3 +660,7 @@ assert p[0].get_alias() is None assert p[2].value == 'AS' assert p[4].value == 'WITH' + +def test_grouping_create_table(): + p = sqlparse.parse("create table db.tbl (a string)")[0].tokens + assert p[4].value == "db.tbl" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/tests/test_parse.py new/sqlparse-0.4.3/tests/test_parse.py --- old/sqlparse-0.4.2/tests/test_parse.py 2021-07-14 15:57:11.000000000 +0200 +++ new/sqlparse-0.4.3/tests/test_parse.py 2022-09-10 10:05:08.000000000 +0200 @@ -132,6 +132,12 @@ assert type(t[0]) is sql.Function +def test_parse_div_operator(): + p = sqlparse.parse('col1 DIV 5 AS div_col1')[0].tokens + assert p[0].tokens[0].tokens[2].ttype is T.Operator + assert p[0].get_alias() == 'div_col1' + + def test_quoted_identifier(): t = sqlparse.parse('select x.y as "z" from foo')[0].tokens assert isinstance(t[2], sql.Identifier) @@ -142,6 +148,7 @@ @pytest.mark.parametrize('name', [ 'foo', '_foo', # issue175 '1_data', # valid MySQL table name, see issue337 + '????????????', # valid at least for SQLite3, see issue641 ]) def test_valid_identifier_names(name): t = sqlparse.parse(name)[0].tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/tests/test_regressions.py new/sqlparse-0.4.3/tests/test_regressions.py --- old/sqlparse-0.4.2/tests/test_regressions.py 2020-10-19 08:40:01.000000000 +0200 +++ new/sqlparse-0.4.3/tests/test_regressions.py 2022-09-06 21:32:40.000000000 +0200 @@ -401,6 +401,15 @@ assert p.tokens[-1].get_alias() == 'foo' +def test_issue562_tzcasts(): + # Test that whitespace between 'from' and 'bar' is retained + formatted = sqlparse.format( + 'SELECT f(HOUR from bar AT TIME ZONE \'UTC\') from foo', reindent=True + ) + assert formatted == \ + 'SELECT f(HOUR\n from bar AT TIME ZONE \'UTC\')\nfrom foo' + + def test_as_in_parentheses_indents(): # did raise NoneType has no attribute is_group in _process_parentheses formatted = sqlparse.format('(as foo)', reindent=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.4.2/tests/test_utils.py new/sqlparse-0.4.3/tests/test_utils.py --- old/sqlparse-0.4.2/tests/test_utils.py 1970-01-01 01:00:00.000000000 +0100 +++ new/sqlparse-0.4.3/tests/test_utils.py 2022-09-06 21:32:40.000000000 +0200 @@ -0,0 +1,12 @@ +import pytest + +from sqlparse import utils + + +@pytest.mark.parametrize('value, expected', ( + [None, None], + ['\'foo\'', 'foo'], + ['"foo"', 'foo'], + ['`foo`', 'foo'])) +def test_remove_quotes(value, expected): + assert utils.remove_quotes(value) == expected