Sql-metadata

Latest version: v2.11.0

Safety actively analyzes 630094 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 6

2.1.0

This release of `sql-metadata` brings a few fixes regarding handling of leading digits in table names (139), inline comments (147) and columns with names containing SQL keywords (141).

* 139 `bug` - Tables with leading digits are not properly recognized
* 140 `enhancement` - Improved handling of tables names with leading digits
* 141 `bug` - Columns with names that start with a keyword are not recognized as a column (by markderry)
* 142 `dependencies` - build(deps-dev): bump pytest-cov from 2.11.1 to 2.12.0 (by dependabot[bot])
* 143 `enhancement` - Tables with leading digits (by collerek)
* 146 `bug` - Relevant keywords change, fix parenthesis helper (by collerek)
* 147 `bug` - Queries with in-line comments (--) are commenting out the entire rest of the query (by taringoo)
* 148 `internals` - CI - update poetry action version

2.0.0

This major release of `sql-metadata` **brings a completely new parser and API** implemented by collerek on top of proposals from 83 and 98.

The gist of the changes is **the introduction of the `Parser` class** (see 121) that is later used to get the list columns, tables, aliases.

`CREATE TABLE` queries are now supported (35). Aliases handling has been greatly improved thanks to 131.

Code coverage has been improved and is now kept at 100%.

Example

python
from sql_metadata import Parser

parsed = Parser("SELECT test, id FROM foo, bar")

parsed.columns ['test', 'id']
parsed.tables ['foo', 'bar']


Migrating from `sql_metadata` 1.x

`sql_metadata.compat` module has been implemented to make the introduction of sql-metadata v2.0 smoother.

You can use it by simply changing the imports in your code from:

python
from sql_metadata import get_query_columns, get_query_tables


into:

python
from sql_metadata.compat import get_query_columns, get_query_tables


The following functions from the old API are available in the `sql_metadata.compat` module:

* `generalize_sql`
* `get_query_columns` (since 131 columns aliases ARE NOT returned by this function)
* `get_query_limit_and_offset`
* `get_query_tables`
* `get_query_tokens`
* `preprocess_query`

Changes

* 35 `enhancement` - Support for CREATE TABLE... statements (by sandeep-pareek)
* 83 `enhancement` - New API [draft]
* 85 `Postgres` - Support Postgres quoted identifiers (by LanDinh)
* 98 `internals` - Improve get_query_tokens iterator
* 103 `question` - Best way to get an array of values? (by jplock)
* 112 `bug` - missing tables returned by sql_metadata.get_query_tables (by tdebroc)
* 121 `enhancement` - New parser, bug fixes and new functionality. (by collerek)
* 125 `bug` - sql_metadata.get_query_columns result error (by chen-ABC)
* 126 `enhancement` - Add a support for CREATE TABLE queries
* 127 `pr` - Improved handling of custom SQL functions when getting the list of columns
* 128 `bug` - get_query_tables() is returning columns on WITH statements (by remisalmon)
* 129 `dependencies` - build(deps-dev): bump black from 21.4b2 to 21.5b0 (by dependabot[bot])
* 130 `dependencies` - build(deps-dev): bump pytest from 6.2.3 to 6.2.4 (by dependabot[bot])
* 131 `enhancement` - Column aliases support (by collerek)
* 133 `dependencies` - build(deps-dev): bump black from 21.5b0 to 21.5b1 (by dependabot[bot])
* 135 `internals` - tool.coverage.report: require 100% code coverage
* 136 `internals` - CI - use Makefile commands
* 137 `internals` - Introduce a compatibility layer for 1.x functions

1.12.0

* 100 `internals` - Lint after running tests
* 101 `dependencies` - build(deps-dev): bump pylint from 2.6.2 to 2.7.0 (by dependabot[bot])
* 102 `dependencies` - build(deps-dev): bump pylint from 2.7.0 to 2.7.1 (by dependabot[bot])
* 104 `dependencies` - build(deps-dev): bump coverage from 5.4 to 5.5 (by dependabot[bot])
* 108 `internals` - Use poetry 1.1.5
* 109 `internals` - CI - store ~/.cache dir + pip install wheel
* 110 `internals` - actions/cache: invalidate on poetry.lock change
* 113 `enhancement` - Improved brackets handling
* 116 `dependencies` - build(deps-dev): bump pytest from 6.2.2 to 6.2.3 (by dependabot[bot])
* 117 `dependencies` - snok/install-poetryv1.1.3
* 118 `dependencies` - build(deps-dev): bump pylint from 2.7.4 to 2.8.1 (by dependabot[bot])
* 119 `dependencies` - build(deps-dev): bump pylint from 2.8.1 to 2.8.2 (by dependabot[bot])
* 123 `dependencies` - Upgrade black to 21.4b1
* 124 `dependencies` - build(deps-dev): bump black from 21.4b1 to 21.4b2 (by dependabot[bot])

1.11.0

This release brings two bug fixes from aborecki (dzięki! 🙂 🇵🇱 ) and introduces [`poetry` as the dependency manager](https://python-poetry.org/docs/).

Changelog

* 79 `bug` - Wrong parsing results from get_query_tables for select with UNION (by aborecki)
* 80 `bug` - Wrong parsing results get_query_tables for spaces in GROUP BY keyword (by aborecki)
* 81 `internals` - Use Poetry as dependency manager and PyPI publish tool
* 86 `dependencies` - build(deps-dev): bump pytest from 6.2.1 to 6.2.2 (by dependabot[bot])
* 87 `dependencies` - build(deps-dev): bump coverage from 5.3.1 to 5.4 (by dependabot[bot])
* 88 `internals` - Run tests on both Python 3.8 and 3.9
* 89 `internals` - Test with Python 3.7 too
* 90 `internals` - Improve CI cache handling
* 91 `internals` - Load cached Poetry venv
* 92 `internals` - Try to test using Python 3.6 and 3.7 too
* 93 `internals` - Tests - add code coverage report
* 94 `bug` - Union's don't return the correct result (by dylwylie)
* 95 `dependencies` - build(deps-dev): bump pylint from 2.6.0 to 2.6.2 (by dependabot[bot])
* 96 `pr` - Extend test coverage for UNION queries

1.10.0

Bug fixes

get_query_columns does not return nothing if parsing SELECT DISTINCT 72 (reported by benzzdan)
get_query_tables() CTE Case Sensitive for SELECT 71 (reported by nehalj12)

Other

Install black code formatter 63
build(deps-dev): bump coverage from 5.3 to 5.3.1 75
build(deps-dev): bump pytest from 6.2.0 to 6.2.1 74
build(deps-dev): bump pytest from 6.1.2 to 6.2.0 73
CI: cache pip dependencies 70
build(deps-dev): bump pytest from 6.1.1 to 6.1.2 69

1.9.1

sqlparse` - Remove debug print statement (https://github.com/andialbrecht/sqlparse/commit/ab53a4b25f853a79d63a6723efaf568b0be02711)

Page 3 of 6

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.