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 2024-08-20 16:12:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-sqlparse (Old) and /work/SRC/openSUSE:Factory/.python-sqlparse.new.2698 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-sqlparse" Tue Aug 20 16:12:48 2024 rev:19 rq:1194657 version:0.5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-sqlparse/python-sqlparse.changes 2024-05-08 11:38:52.102885476 +0200 +++ /work/SRC/openSUSE:Factory/.python-sqlparse.new.2698/python-sqlparse.changes 2024-08-20 16:12:58.733128481 +0200 @@ -1,0 +2,18 @@ +Mon Aug 19 07:42:50 UTC 2024 - Dirk Müller <dmuel...@suse.com> + +- update to 0.5.1: + * New "compact" option for formatter. If set, the formatter + tries to produce a more compact output by avoiding some line + breaks + * The strip comments filter was a bit greedy and removed too + much whitespace (issue772). Note: In some cases you might want + to add `strip_whitespace=True` where you previously used just + `strip_comments=True`. `strip_comments` did some of the + work that `strip_whitespace` should do. + * Fix error when splitting statements that contain multiple + CASE clauses within a BEGIN block (issue784). + * Fix whitespace removal with nested expressions (issue782). + * Fix parsing and formatting of ORDER clauses containing NULLS + FIRST or NULLS LAST (issue532). + +------------------------------------------------------------------- Old: ---- sqlparse-0.5.0.tar.gz New: ---- sqlparse-0.5.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-sqlparse.spec ++++++ --- /var/tmp/diff_new_pack.8Ufeh2/_old 2024-08-20 16:12:59.973179990 +0200 +++ /var/tmp/diff_new_pack.8Ufeh2/_new 2024-08-20 16:12:59.977180156 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-sqlparse -Version: 0.5.0 +Version: 0.5.1 Release: 0 Summary: Non-validating SQL parser License: BSD-3-Clause ++++++ sqlparse-0.5.0.tar.gz -> sqlparse-0.5.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/.idea/workspace.xml new/sqlparse-0.5.1/.idea/workspace.xml --- old/sqlparse-0.5.0/.idea/workspace.xml 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/.idea/workspace.xml 2020-02-02 01:00:00.000000000 +0100 @@ -7,10 +7,7 @@ <option name="autoReloadType" value="SELECTIVE" /> </component> <component name="ChangeListManager"> - <list default="true" id="c1a6b0e3-80de-4ea3-bc7d-6f3970b9f7ef" name="Changes" comment="Raise recursion limit for tests."> - <change beforePath="$PROJECT_DIR$/CHANGELOG" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/sqlparse/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/sqlparse/__init__.py" afterDir="false" /> - </list> + <list default="true" id="c1a6b0e3-80de-4ea3-bc7d-6f3970b9f7ef" name="Changes" comment="Fix grouping of comments (fixes #772). The grouping of comments was a bit too greedy by also consuming whitespaces at the end." /> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> @@ -45,6 +42,7 @@ </component> <component name="PropertiesComponent">{ "keyToString": { + "Python tests.pytest for test_format.TestFormat.test_strip_comments_preserves_whitespace.executor": "Run", "Python tests.pytest for test_format.test_format_json_ops.executor": "Run", "Python tests.pytest for test_parse.test_json_operators.executor": "Run", "Python tests.pytest for test_parse.test_psql_quotation_marks.executor": "Run", @@ -74,8 +72,8 @@ <command value="pytest in /" /> </option> </component> - <component name="RunManager" selected="Python tests.pytest in /"> - <configuration name="pytest for test_format.test_format_json_ops" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true"> + <component name="RunManager" selected="Python tests.pytest for test_format.TestFormat.test_strip_comments_preserves_whitespace"> + <configuration name="pytest for test_format.TestFormat.test_strip_comments_preserves_whitespace" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true"> <module name="sqlparse" /> <option name="ENV_FILES" value="" /> <option name="INTERPRETER_OPTIONS" value="" /> @@ -89,7 +87,7 @@ <option name="_new_keywords" value="""" /> <option name="_new_parameters" value="""" /> <option name="_new_additionalArguments" value="""" /> - <option name="_new_target" value=""test_format.test_format_json_ops"" /> + <option name="_new_target" value=""test_format.TestFormat.test_strip_comments_preserves_whitespace"" /> <option name="_new_targetType" value=""PYTHON"" /> <method v="2" /> </configuration> @@ -185,20 +183,20 @@ <method v="2" /> </configuration> <list> - <item itemvalue="Python tests.pytest in /" /> - <item itemvalue="Python tests.pytest for test_format.test_format_json_ops" /> + <item itemvalue="Python tests.pytest for test_format.TestFormat.test_strip_comments_preserves_whitespace" /> <item itemvalue="Python tests.pytest for test_parse.test_json_operators" /> <item itemvalue="Python tests.pytest for test_parse.test_psql_quotation_marks" /> <item itemvalue="Python tests.pytest for test_regressions.test_primary_key_issue740" /> <item itemvalue="Python tests.pytest for test_regressions.test_split_procedure_issue692" /> + <item itemvalue="Python tests.pytest in /" /> </list> <recent_temporary> <list> + <item itemvalue="Python tests.pytest for test_format.TestFormat.test_strip_comments_preserves_whitespace" /> + <item itemvalue="Python tests.pytest for test_regressions.test_split_procedure_issue692" /> <item itemvalue="Python tests.pytest for test_regressions.test_primary_key_issue740" /> - <item itemvalue="Python tests.pytest for test_format.test_format_json_ops" /> - <item itemvalue="Python tests.pytest for test_parse.test_json_operators" /> <item itemvalue="Python tests.pytest for test_parse.test_psql_quotation_marks" /> - <item itemvalue="Python tests.pytest for test_regressions.test_split_procedure_issue692" /> + <item itemvalue="Python tests.pytest for test_parse.test_json_operators" /> </list> </recent_temporary> </component> @@ -262,7 +260,11 @@ <workItem from="1710699431122" duration="161000" /> <workItem from="1710930875690" duration="38000" /> <workItem from="1713008432744" duration="249000" /> - <workItem from="1713009876522" duration="1160000" /> + <workItem from="1713009876522" duration="1768000" /> + <workItem from="1713164890216" duration="347000" /> + <workItem from="1713165709231" duration="157000" /> + <workItem from="1715582195687" duration="2836000" /> + <workItem from="1715588869387" duration="34000" /> </task> <task id="LOCAL-00001" summary="CI: Use codecov action. codecov module is deprecated and was removed from PyPI in favor of the github action."> <created>1681476722347</created> @@ -271,22 +273,6 @@ <option name="project" value="LOCAL" /> <updated>1681476722347</updated> </task> - <task id="LOCAL-00002" summary="Add classifier for Python 3.11 (fixes #726)."> - <option name="closed" value="true" /> - <created>1688586268576</created> - <option name="number" value="00002" /> - <option name="presentableId" value="LOCAL-00002" /> - <option name="project" value="LOCAL" /> - <updated>1688586268576</updated> - </task> - <task id="LOCAL-00003" summary="Drop support for Python 3.5."> - <option name="closed" value="true" /> - <created>1690182121355</created> - <option name="number" value="00003" /> - <option name="presentableId" value="LOCAL-00003" /> - <option name="project" value="LOCAL" /> - <updated>1690182121355</updated> - </task> <task id="LOCAL-00004" summary="Get tox running again. We have to pin versions for tox and virtualenv because newer versions don't support Python 3.6 anymore."> <option name="closed" value="true" /> <created>1690187016877</created> @@ -647,7 +633,31 @@ <option name="project" value="LOCAL" /> <updated>1713009920360</updated> </task> - <option name="localTasksCounter" value="49" /> + <task id="LOCAL-00049" summary="Bump version."> + <option name="closed" value="true" /> + <created>1713011589338</created> + <option name="number" value="00049" /> + <option name="presentableId" value="LOCAL-00049" /> + <option name="project" value="LOCAL" /> + <updated>1713011589338</updated> + </task> + <task id="LOCAL-00050" summary="Switch back to development mode."> + <option name="closed" value="true" /> + <created>1713011922338</created> + <option name="number" value="00050" /> + <option name="presentableId" value="LOCAL-00050" /> + <option name="project" value="LOCAL" /> + <updated>1713011922339</updated> + </task> + <task id="LOCAL-00051" summary="Fix grouping of comments (fixes #772). The grouping of comments was a bit too greedy by also consuming whitespaces at the end."> + <option name="closed" value="true" /> + <created>1715585190469</created> + <option name="number" value="00051" /> + <option name="presentableId" value="LOCAL-00051" /> + <option name="project" value="LOCAL" /> + <updated>1715585190470</updated> + </task> + <option name="localTasksCounter" value="52" /> <servers /> </component> <component name="TypeScriptGeneratedFilesManager"> @@ -665,9 +675,6 @@ </option> </component> <component name="VcsManagerConfiguration"> - <MESSAGE value="Add comment." /> - <MESSAGE value="Update authors." /> - <MESSAGE value="Update changelog and code cleanup." /> <MESSAGE value="Update changelog." /> <MESSAGE value="Prevent parser from running into max. recursions." /> <MESSAGE value="Improve splitting of Transact SQL when using GO keyword (fixes #762)." /> @@ -690,22 +697,26 @@ <MESSAGE value="Fix parsing of PRIMARY KEY (fixes #740)." /> <MESSAGE value="Update AUHTORS and Changelog." /> <MESSAGE value="Raise recursion limit for tests." /> - <option name="LAST_COMMIT_MESSAGE" value="Raise recursion limit for tests." /> + <MESSAGE value="Bump version." /> + <MESSAGE value="Switch back to development mode." /> + <MESSAGE value="Fix grouping of comments (fixes #772). The grouping of comments was a bit too greedy by also consuming whitespaces at the end." /> + <option name="LAST_COMMIT_MESSAGE" value="Fix grouping of comments (fixes #772). The grouping of comments was a bit too greedy by also consuming whitespaces at the end." /> </component> <component name="com.intellij.coverage.CoverageDataManagerImpl"> - <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_split_test_split_strip_semicolon.coverage" NAME="pytest for test_split.test_split_strip_semicolon Coverage Results" MODIFIED="1697137345685" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> - <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_regressions_test_primary_key_issue740.coverage" NAME="pytest for test_regressions.test_primary_key_issue740 Coverage Results" MODIFIED="1710604966341" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> + <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_split_test_split_go.coverage" NAME="pytest for test_split.test_split_go Coverage Results" MODIFIED="1710486007296" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_regressions_test_copy_issue672.coverage" NAME="pytest for test_regressions.test_copy_issue672 Coverage Results" MODIFIED="1695152213955" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> - <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_parse_test_psql_quotation_marks.coverage" NAME="pytest for test_parse.test_psql_quotation_marks Coverage Results" MODIFIED="1710573863392" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> - <SUITE FILE_PATH="coverage/sqlparse$keywords.coverage" NAME="keywords Coverage Results" MODIFIED="1691652299182" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/sqlparse" /> - <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_split_test_split_oracle_procedure.coverage" NAME="pytest for test_split.test_split_oracle_procedure Coverage Results" MODIFIED="1710240151390" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> + <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_regressions_test_primary_key_issue740.coverage" NAME="pytest for test_regressions.test_primary_key_issue740 Coverage Results" MODIFIED="1710604966341" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> <SUITE FILE_PATH="coverage/sqlparse$pytest_in__.coverage" NAME="pytest in / Coverage Results" MODIFIED="1710604971244" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" /> + <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_parse_test_json_operators.coverage" NAME="pytest for test_parse.test_json_operators Coverage Results" MODIFIED="1710577177438" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> <SUITE FILE_PATH="coverage/sqlparse$others.coverage" NAME="others Coverage Results" MODIFIED="1697137056222" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/sqlparse/filters" /> - <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_format_test_format_json_ops.coverage" NAME="pytest for test_format.test_format_json_ops Coverage Results" MODIFIED="1710580710955" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> - <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_split_test_split_strip_semicolon_procedure.coverage" NAME="pytest for test_split.test_split_strip_semicolon_procedure Coverage Results" MODIFIED="1697137350646" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> + <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_split_test_split_strip_semicolon.coverage" NAME="pytest for test_split.test_split_strip_semicolon Coverage Results" MODIFIED="1697137345685" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> <SUITE FILE_PATH="coverage/sqlparse$__init__.coverage" NAME="__init__ Coverage Results" MODIFIED="1697136188898" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/sqlparse" /> + <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_split_test_split_strip_semicolon_procedure.coverage" NAME="pytest for test_split.test_split_strip_semicolon_procedure Coverage Results" MODIFIED="1697137350646" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> + <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_parse_test_psql_quotation_marks.coverage" NAME="pytest for test_parse.test_psql_quotation_marks Coverage Results" MODIFIED="1710573863392" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_regressions_test_split_procedure_issue692.coverage" NAME="pytest for test_regressions.test_split_procedure_issue692 Coverage Results" MODIFIED="1710572849200" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> - <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_parse_test_json_operators.coverage" NAME="pytest for test_parse.test_json_operators Coverage Results" MODIFIED="1710577177438" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> - <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_split_test_split_go.coverage" NAME="pytest for test_split.test_split_go Coverage Results" MODIFIED="1710486007296" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> + <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_format_TestFormat_test_strip_comments_preserves_whitespace.coverage" NAME="pytest for test_format.TestFormat.test_strip_comments_preserves_whitespace Coverage Results" MODIFIED="1715582314052" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> + <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_split_test_split_oracle_procedure.coverage" NAME="pytest for test_split.test_split_oracle_procedure Coverage Results" MODIFIED="1710240151390" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> + <SUITE FILE_PATH="coverage/sqlparse$pytest_for_test_format_test_format_json_ops.coverage" NAME="pytest for test_format.test_format_json_ops Coverage Results" MODIFIED="1710580710955" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" /> + <SUITE FILE_PATH="coverage/sqlparse$keywords.coverage" NAME="keywords Coverage Results" MODIFIED="1691652299182" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/sqlparse" /> </component> </project> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/CHANGELOG new/sqlparse-0.5.1/CHANGELOG --- old/sqlparse-0.5.0/CHANGELOG 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/CHANGELOG 2020-02-02 01:00:00.000000000 +0100 @@ -1,3 +1,25 @@ +Release 0.5.1 (Jul 15, 2024) +---------------------------- + +Enhancements + +* New "compact" option for formatter. If set, the formatter tries to produce + a more compact output by avoiding some line breaks (issue783). + +Bug Fixes + +* The strip comments filter was a bit greedy and removed too much + whitespace (issue772). + Note: In some cases you might want to add `strip_whitespace=True` where you + previously used just `strip_comments=True`. `strip_comments` did some of the + work that `strip_whitespace` should do. +* Fix error when splitting statements that contain multiple CASE clauses + within a BEGIN block (issue784). +* Fix whitespace removal with nested expressions (issue782). +* Fix parsing and formatting of ORDER clauses containing NULLS FIRST or + NULLS LAST (issue532). + + Release 0.5.0 (Apr 13, 2024) ---------------------------- @@ -11,11 +33,11 @@ https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-2m57-hf25-phgg The vulnerability was discovered by @uriyay-jfrog. Thanks for reporting! -Enhancements: +Enhancements * Splitting statements now allows to remove the semicolon at the end. Some database backends love statements without semicolon (issue742). -* Support TypedLiterals in get_parameters (pr649, by Khrol). +* Support TypedLiterals in get_parameters (pr749, by Khrol). * Improve splitting of Transact SQL when using GO keyword (issue762). * Support for some JSON operators (issue682). * Improve formatting of statements containing JSON operators (issue542). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/PKG-INFO new/sqlparse-0.5.1/PKG-INFO --- old/sqlparse-0.5.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 @@ -1,10 +1,10 @@ Metadata-Version: 2.3 Name: sqlparse -Version: 0.5.0 +Version: 0.5.1 Summary: A non-validating SQL parser. Project-URL: Home, https://github.com/andialbrecht/sqlparse Project-URL: Documentation, https://sqlparse.readthedocs.io/ -Project-URL: Release Notes, https://sqlparse.readthedocs.io/en/latest/changes/ +Project-URL: Release Notes, https://sqlparse.readthedocs.io/en/latest/changes.html Project-URL: Source, https://github.com/andialbrecht/sqlparse Project-URL: Tracker, https://github.com/andialbrecht/sqlparse/issues Author-email: Andi Albrecht <albrecht.a...@gmail.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/docs/source/api.rst new/sqlparse-0.5.1/docs/source/api.rst --- old/sqlparse-0.5.0/docs/source/api.rst 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/docs/source/api.rst 2020-02-02 01:00:00.000000000 +0100 @@ -62,6 +62,9 @@ The column limit (in characters) for wrapping comma-separated lists. If unspecified, it puts every item in the list on its own line. +``compact`` + If ``True`` the formatter tries to produce more compact output. + ``output_format`` If given the output is additionally formatted to be used as a variable in a programming language. Allowed values are "python" and "php". @@ -69,4 +72,4 @@ ``comma_first`` If ``True`` comma-first notation for column names is used. - + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/pyproject.toml new/sqlparse-0.5.1/pyproject.toml --- old/sqlparse-0.5.0/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 @@ -31,7 +31,7 @@ [project.urls] Home = "https://github.com/andialbrecht/sqlparse" Documentation = "https://sqlparse.readthedocs.io/" -"Release Notes" = "https://sqlparse.readthedocs.io/en/latest/changes/" +"Release Notes" = "https://sqlparse.readthedocs.io/en/latest/changes.html" Source = "https://github.com/andialbrecht/sqlparse" Tracker = "https://github.com/andialbrecht/sqlparse/issues" @@ -60,7 +60,7 @@ "flake8", ] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" +unittest = "pytest {args:tests}" test-cov = "coverage run -m pytest {args:tests}" cov-report = [ "- coverage combine", @@ -71,6 +71,7 @@ "cov-report", ] check = "flake8 sqlparse/" +test = ["check", "unittest"] [[tool.hatch.envs.all.matrix]] python = ["3.8", "3.9", "3.10", "3.11", "3.12"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/sqlparse/__init__.py new/sqlparse-0.5.1/sqlparse/__init__.py --- old/sqlparse-0.5.0/sqlparse/__init__.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/sqlparse/__init__.py 2020-02-02 01:00:00.000000000 +0100 @@ -16,7 +16,7 @@ from sqlparse import formatter -__version__ = '0.5.0' +__version__ = '0.5.1' __all__ = ['engine', 'filters', 'formatter', 'sql', 'tokens', 'cli'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/sqlparse/cli.py new/sqlparse-0.5.1/sqlparse/cli.py --- old/sqlparse-0.5.0/sqlparse/cli.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/sqlparse/cli.py 2020-02-02 01:00:00.000000000 +0100 @@ -140,6 +140,13 @@ help='Insert linebreak before comma (default False)') group.add_argument( + '--compact', + dest='compact', + default=False, + type=bool, + help='Try to produce more compact output (default False)') + + group.add_argument( '--encoding', dest='encoding', default='utf-8', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/sqlparse/engine/grouping.py new/sqlparse-0.5.1/sqlparse/engine/grouping.py --- old/sqlparse-0.5.0/sqlparse/engine/grouping.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/sqlparse/engine/grouping.py 2020-02-02 01:00:00.000000000 +0100 @@ -314,7 +314,7 @@ tidx, token = tlist.token_next_by(t=T.Comment) while token: eidx, end = tlist.token_not_matching( - lambda tk: imt(tk, t=T.Comment) or tk.is_whitespace, idx=tidx) + lambda tk: imt(tk, t=T.Comment) or tk.is_newline, idx=tidx) if end is not None: eidx, end = tlist.token_prev(eidx, skip_ws=False) tlist.group_tokens(sql.Comment, tidx, eidx) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/sqlparse/engine/statement_splitter.py new/sqlparse-0.5.1/sqlparse/engine/statement_splitter.py --- old/sqlparse-0.5.0/sqlparse/engine/statement_splitter.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/sqlparse/engine/statement_splitter.py 2020-02-02 01:00:00.000000000 +0100 @@ -17,6 +17,7 @@ def _reset(self): """Set the filter attributes to its default values""" self._in_declare = False + self._in_case = False self._is_create = False self._begin_depth = 0 @@ -58,16 +59,18 @@ return 1 return 0 - # Should this respect a preceding BEGIN? - # In CASE ... WHEN ... END this results in a split level -1. - # Would having multiple CASE WHEN END and a Assignment Operator - # cause the statement to cut off prematurely? + # BEGIN and CASE/WHEN both end with END if unified == 'END': - self._begin_depth = max(0, self._begin_depth - 1) + if not self._in_case: + self._begin_depth = max(0, self._begin_depth - 1) + else: + self._in_case = False return -1 if (unified in ('IF', 'FOR', 'WHILE', 'CASE') and self._is_create and self._begin_depth > 0): + if unified == 'CASE': + self._in_case = True return 1 if unified in ('END IF', 'END FOR', 'END WHILE'): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/sqlparse/filters/others.py new/sqlparse-0.5.1/sqlparse/filters/others.py --- old/sqlparse-0.5.0/sqlparse/filters/others.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/sqlparse/filters/others.py 2020-02-02 01:00:00.000000000 +0100 @@ -91,6 +91,10 @@ tlist.tokens.pop(1) while tlist.tokens[-2].is_whitespace: tlist.tokens.pop(-2) + if tlist.tokens[-2].is_group: + # save to remove the last whitespace + while tlist.tokens[-2].tokens[-1].is_whitespace: + tlist.tokens[-2].tokens.pop(-1) self._stripws_default(tlist) def process(self, stmt, depth=0): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/sqlparse/filters/reindent.py new/sqlparse-0.5.1/sqlparse/filters/reindent.py --- old/sqlparse-0.5.0/sqlparse/filters/reindent.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/sqlparse/filters/reindent.py 2020-02-02 01:00:00.000000000 +0100 @@ -12,7 +12,7 @@ class ReindentFilter: def __init__(self, width=2, char=' ', wrap_after=0, n='\n', comma_first=False, indent_after_first=False, - indent_columns=False): + indent_columns=False, compact=False): self.n = n self.width = width self.char = char @@ -21,6 +21,7 @@ self.wrap_after = wrap_after self.comma_first = comma_first self.indent_columns = indent_columns + self.compact = compact self._curr_stmt = None self._last_stmt = None self._last_func = None @@ -196,15 +197,19 @@ with offset(self, self._get_offset(tlist[0])): with offset(self, self._get_offset(first)): for cond, value in iterable: - token = value[0] if cond is None else cond[0] - tlist.insert_before(token, self.nl()) + str_cond = ''.join(str(x) for x in cond or []) + str_value = ''.join(str(x) for x in value) + end_pos = self.offset + 1 + len(str_cond) + len(str_value) + if (not self.compact and end_pos > self.wrap_after): + token = value[0] if cond is None else cond[0] + tlist.insert_before(token, self.nl()) # Line breaks on group level are done. let's add an offset of # len "when ", "then ", "else " with offset(self, len("WHEN ")): self._process_default(tlist) end_idx, end = tlist.token_next_by(m=sql.Case.M_CLOSE) - if end_idx is not None: + if end_idx is not None and not self.compact: tlist.insert_before(end_idx, self.nl()) def _process_values(self, tlist): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/sqlparse/formatter.py new/sqlparse-0.5.1/sqlparse/formatter.py --- old/sqlparse-0.5.0/sqlparse/formatter.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/sqlparse/formatter.py 2020-02-02 01:00:00.000000000 +0100 @@ -11,7 +11,7 @@ from sqlparse.exceptions import SQLParseError -def validate_options(options): +def validate_options(options): # noqa: C901 """Validates options.""" kwcase = options.get('keyword_case') if kwcase not in [None, 'upper', 'lower', 'capitalize']: @@ -116,6 +116,11 @@ raise SQLParseError('comma_first requires a boolean value') options['comma_first'] = comma_first + compact = options.get('compact', False) + if compact not in [True, False]: + raise SQLParseError('compact requires a boolean value') + options['compact'] = compact + right_margin = options.get('right_margin') if right_margin is not None: try: @@ -171,7 +176,8 @@ indent_after_first=options['indent_after_first'], indent_columns=options['indent_columns'], wrap_after=options['wrap_after'], - comma_first=options['comma_first'])) + comma_first=options['comma_first'], + compact=options['compact'],)) if options.get('reindent_aligned', False): stack.enable_grouping() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/sqlparse/keywords.py new/sqlparse-0.5.1/sqlparse/keywords.py --- old/sqlparse-0.5.0/sqlparse/keywords.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/sqlparse/keywords.py 2020-02-02 01:00:00.000000000 +0100 @@ -71,7 +71,9 @@ r'|(CROSS\s+|NATURAL\s+)?)?JOIN\b', tokens.Keyword), (r'END(\s+IF|\s+LOOP|\s+WHILE)?\b', tokens.Keyword), (r'NOT\s+NULL\b', tokens.Keyword), - (r'NULLS\s+(FIRST|LAST)\b', tokens.Keyword), + (r'(ASC|DESC)(\s+NULLS\s+(FIRST|LAST))?\b', tokens.Keyword.Order), + (r'(ASC|DESC)\b', tokens.Keyword.Order), + (r'NULLS\s+(FIRST|LAST)\b', tokens.Keyword.Order), (r'UNION\s+ALL\b', tokens.Keyword), (r'CREATE(\s+OR\s+REPLACE)?\b', tokens.Keyword.DDL), (r'DOUBLE\s+PRECISION\b', tokens.Name.Builtin), @@ -114,7 +116,6 @@ 'ANY': tokens.Keyword, 'ARRAYLEN': tokens.Keyword, 'ARE': tokens.Keyword, - 'ASC': tokens.Keyword.Order, 'ASENSITIVE': tokens.Keyword, 'ASSERTION': tokens.Keyword, 'ASSIGNMENT': tokens.Keyword, @@ -227,7 +228,6 @@ 'DELIMITER': tokens.Keyword, 'DELIMITERS': tokens.Keyword, 'DEREF': tokens.Keyword, - 'DESC': tokens.Keyword.Order, 'DESCRIBE': tokens.Keyword, 'DESCRIPTOR': tokens.Keyword, 'DESTROY': tokens.Keyword, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/sqlparse/sql.py new/sqlparse-0.5.1/sqlparse/sql.py --- old/sqlparse-0.5.0/sqlparse/sql.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/sqlparse/sql.py 2020-02-02 01:00:00.000000000 +0100 @@ -46,7 +46,7 @@ """ __slots__ = ('value', 'ttype', 'parent', 'normalized', 'is_keyword', - 'is_group', 'is_whitespace') + 'is_group', 'is_whitespace', 'is_newline') def __init__(self, ttype, value): value = str(value) @@ -56,6 +56,7 @@ self.is_group = False self.is_keyword = ttype in T.Keyword self.is_whitespace = self.ttype in T.Whitespace + self.is_newline = self.ttype in T.Newline self.normalized = value.upper() if self.is_keyword else value def __str__(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/tests/files/multiple_case_in_begin.sql new/sqlparse-0.5.1/tests/files/multiple_case_in_begin.sql --- old/sqlparse-0.5.0/tests/files/multiple_case_in_begin.sql 1970-01-01 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/tests/files/multiple_case_in_begin.sql 2020-02-02 01:00:00.000000000 +0100 @@ -0,0 +1,8 @@ +CREATE TRIGGER mytrig +AFTER UPDATE OF vvv ON mytable +BEGIN + UPDATE aa + SET mycola = (CASE WHEN (A=1) THEN 2 END); + UPDATE bb + SET mycolb = (CASE WHEN (B=1) THEN 5 END); +END; \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/tests/test_format.py new/sqlparse-0.5.1/tests/test_format.py --- old/sqlparse-0.5.0/tests/test_format.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/tests/test_format.py 2020-02-02 01:00:00.000000000 +0100 @@ -73,15 +73,15 @@ assert res == 'select' sql = '/* sql starts here */ select' res = sqlparse.format(sql, strip_comments=True) - assert res == 'select' + assert res == ' select' # note whitespace is preserved, see issue 772 sql = '/*\n * sql starts here\n */\nselect' res = sqlparse.format(sql, strip_comments=True) assert res == 'select' sql = 'select (/* sql starts here */ select 2)' - res = sqlparse.format(sql, strip_comments=True) + res = sqlparse.format(sql, strip_comments=True, strip_whitespace=True) assert res == 'select (select 2)' sql = 'select (/* sql /* starts here */ select 2)' - res = sqlparse.format(sql, strip_comments=True) + res = sqlparse.format(sql, strip_comments=True, strip_whitespace=True) assert res == 'select (select 2)' def test_strip_comments_preserves_linebreak(self): @@ -101,6 +101,11 @@ res = sqlparse.format(sql, strip_comments=True) assert res == 'select *\n\nfrom foo' + def test_strip_comments_preserves_whitespace(self): + sql = 'SELECT 1/*bar*/ AS foo' # see issue772 + res = sqlparse.format(sql, strip_comments=True) + assert res == 'SELECT 1 AS foo' + def test_strip_ws(self): f = lambda sql: sqlparse.format(sql, strip_whitespace=True) s = 'select\n* from foo\n\twhere ( 1 = 2 )\n' @@ -729,3 +734,21 @@ "select foo->'bar', foo->'bar';", reindent=True) expected = "select foo->'bar',\n foo->'bar';" assert formatted == expected + + +@pytest.mark.parametrize('sql, expected_normal, expected_compact', [ + ('case when foo then 1 else bar end', + 'case\n when foo then 1\n else bar\nend', + 'case when foo then 1 else bar end')]) +def test_compact(sql, expected_normal, expected_compact): # issue783 + formatted_normal = sqlparse.format(sql, reindent=True) + formatted_compact = sqlparse.format(sql, reindent=True, compact=True) + assert formatted_normal == expected_normal + assert formatted_compact == expected_compact + + +def test_strip_ws_removes_trailing_ws_in_groups(): # issue782 + formatted = sqlparse.format('( where foo = bar ) from', + strip_whitespace=True) + expected = '(where foo = bar) from' + assert formatted == expected diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/tests/test_grouping.py new/sqlparse-0.5.1/tests/test_grouping.py --- old/sqlparse-0.5.0/tests/test_grouping.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/tests/test_grouping.py 2020-02-02 01:00:00.000000000 +0100 @@ -17,13 +17,6 @@ assert len(parsed.tokens[2].tokens[3].tokens) == 3 -def test_grouping_comments(): - s = '/*\n * foo\n */ \n bar' - parsed = sqlparse.parse(s)[0] - assert str(parsed) == s - assert len(parsed.tokens) == 2 - - @pytest.mark.parametrize('s', ['foo := 1;', 'foo := 1']) def test_grouping_assignment(s): parsed = sqlparse.parse(s)[0] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/tests/test_split.py new/sqlparse-0.5.1/tests/test_split.py --- old/sqlparse-0.5.0/tests/test_split.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/tests/test_split.py 2020-02-02 01:00:00.000000000 +0100 @@ -203,3 +203,8 @@ def test_split_go(sql, num): # issue762 stmts = sqlparse.split(sql) assert len(stmts) == num + + +def test_split_multiple_case_in_begin(load_file): # issue784 + stmts = sqlparse.split(load_file('multiple_case_in_begin.sql')) + assert len(stmts) == 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlparse-0.5.0/tests/test_tokenize.py new/sqlparse-0.5.1/tests/test_tokenize.py --- old/sqlparse-0.5.0/tests/test_tokenize.py 2020-02-02 01:00:00.000000000 +0100 +++ new/sqlparse-0.5.1/tests/test_tokenize.py 2020-02-02 01:00:00.000000000 +0100 @@ -169,11 +169,16 @@ assert p.tokens[0].ttype is T.Keyword -@pytest.mark.parametrize('s', ['NULLS FIRST', 'NULLS LAST']) -def test_parse_nulls(s): # issue487 +@pytest.mark.parametrize('s', [ + 'ASC', 'DESC', + 'NULLS FIRST', 'NULLS LAST', + 'ASC NULLS FIRST', 'ASC NULLS LAST', + 'DESC NULLS FIRST', 'DESC NULLS LAST', +]) +def test_parse_order(s): # issue487 p = sqlparse.parse(s)[0] assert len(p.tokens) == 1 - assert p.tokens[0].ttype is T.Keyword + assert p.tokens[0].ttype is T.Keyword.Order @pytest.mark.parametrize('s', [