Piccolo-api

Latest version: v1.5.2

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

Scan your dependencies

Page 11 of 21

0.24.0

------

Added support for nested models in ``create_pydantic_model``. For each
``ForeignKey`` in the Piccolo table, the Pydantic model will contain a sub
model for the related table.

For example:

.. code-block::

class Manager(Table):
name = Varchar()

class Band(Table):
name = Varchar()
manager = ForeignKey(Manager)

BandModel = create_pydantic_model(Band, nested=True)

If we were to write ``BandModel`` by hand instead, it would look like this:

.. code-block::

class ManagerModel(BaseModel):
name: str

class BandModel(BaseModel):
name: str
manager: ManagerModel

This feature is designed to work with the new ``nested`` output option in
Piccolo >= 0.40.0, which returns the data in the correct format to pass
directly to the nested Pydantic model.

.. code-block::

band = Band.select(
Band.id,
Band.name,
*Band.manager.all_columns()
).first(
).output(
nested=True
).run_sync()
>>> print(band)
{'id': 1, 'name': 'Pythonistas', 'manager': {'id': 1, 'name': 'Guido'}}

BandModel(**band)

Courtesy aminalaee.

-------------------------------------------------------------------------------

0.23.1

------

Make sure ``asyncpg`` gets installed, as Piccolo API currently has a hard
requirement on it (we hope to fix this in the future).

-------------------------------------------------------------------------------

0.23.0

------

* Fixed MyPy errors (courtesy sinisaos).
* Simplification of JWT authentication - it no longer needlessly checks
expiry, as PyJWT already does this (courtesy aminalaee).
* Substantial increase in code coverage (courtesy aminalaee and sinisaos).
* Increased the minimum PyJWT version, as versions > 2.0.0 return the JWT as a
string instead of bytes.
* Added an option to exclude columns when using ``create_pydantic_model``
(courtesy kucera-lukas).

-------------------------------------------------------------------------------

0.22.0

------

Updating ``PiccoloCRUD`` so it works better with the custom primary key feature
added in Piccolo.

-------------------------------------------------------------------------------

0.21.1

------

Minor changes to the custom login template logic. More complex Jinja templates
are now supported (which are extended from other Jinja templates).

-------------------------------------------------------------------------------

0.21.0

------

Session auth improvements:

* The default login template is much nicer now.
* The login template can be overridden with a custom one, to match the look
and feel of the application.
* The ``session_logout`` endpoint can now redirect after successfully logging
out.

-------------------------------------------------------------------------------

Page 11 of 21

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.