Sqlschm

Latest version: v0.8.0

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

Scan your dependencies

Page 1 of 2

0.8.0

- BREAKING CHANGES: support for indexes

sqlschm is now able to parse indexes such as:

sql
CREATE INDEX person_major_index ON person(age) WHERE major > 18;


As a consequence, we renamed `tables` of `sql.Schema` by `items`.
You can update your code in the following way:

py
from
schema.tables
to
schema.tables()


`schema.indexes()` returns all indexes.

- BREAKING CHANGES: remove sql.Alias

py
from
foreign_key.foreign_table.name

to
foreign_key.foreign_table


- Add helper functions

`sql.referred_columns` allows computing referred columns by a foreign key.
If referred columns are unspecified, then the function returns
the columns of the primary key of the foreign table.

`sql.test_resolve_foreign_key` traverse the graph of references
until a column that is not a foreign key is found.
Traversed foreign keys are yield.
Note that this may produce an endless sequence of foreign keys
in the case of cyclic foreign keys.

0.7.0

- BREAKING CHANGES: use tuples instead of Sequence abstraction

This has the advantage to make every object hashable.

- BREAKING CHANGES: use iterables instead of lists in method return type

This uniformizes the API and avoids some memory allocation

0.6.1

- Allow schemas with empty statements that end with a semicolon

0.6.0

- Add shortcuts to access column names of a uniqueness constraint

- Add shortcuts to access generated constraint of a column

0.5.0

- BREAKING CHANGES: Lossless parsing

The produced AST expose now DEFAULT, GENERATED, and CHECK constraint.

0.4.0

- Expose foreign keys' match value in the AST

- BREAKING CHANGES: parse and expose indexed columns in the AST

SQLite enables to specify the collation and the sorting order
of a column inside a unique or primary key constraint.

The following schema is now properly parsed:

sql
CREATE TABLE person(
fullname NOT NULL,
PRIMARY KEY (fullname COLLATE BINARY ASC)
);


Collation and sorting order are exported in the the AST.

- BREAKING CHANGES: more generic AST

Previously the parser did assumptions about the default values of
some clause. It now do less assumption and thus it is more generic.

Some node of the AST accept now None.

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.