Piccolo

Latest version: v1.5.0

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

Scan your dependencies

Page 10 of 48

0.87.0

Not secure
------

When using ``get_or_create`` with ``prefetch`` the behaviour was inconsistent -
it worked as expected when the row already existed, but prefetch wasn't working
if the row was being created. This now works as expected:

.. code-block:: python

>>> band = Band.objects(Band.manager).get_or_create(
... (Band.name == "New Band 2") & (Band.manager == 1)
... )

>>> band.manager
<Manager: 1>
>>> band.manager.name
"Mr Manager"

Thanks to backwardspy for reporting this issue.

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

0.86.0

Not secure
------

Added the ``Email`` column type. It's basically identical to ``Varchar``,
except that when we use ``create_pydantic_model`` we add email validation
to the generated Pydantic model.

.. code-block:: python

from piccolo.columns.column_types import Email
from piccolo.table import Table
from piccolo.utils.pydantic import create_pydantic_model


class MyTable(Table):
email = Email()


model = create_pydantic_model(MyTable)

model(email="not a valid email")
ValidationError!

Thanks to sinisaos for implementing this feature.

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

0.85.1

Not secure
------

Fixed a bug with migrations - when run backwards, ``raw`` was being called
instead of ``raw_backwards``. Thanks to translunar for the fix.

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

0.85.0

Not secure
------

You can now append items to an array in an update query:

.. code-block:: python

await Ticket.update({
Ticket.seat_numbers: Ticket.seat_numbers + [1000]
}).where(Ticket.id == 1)

Currently Postgres only. Thanks to sumitsharansatsangi for suggesting this
feature.

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

0.84.0

Not secure
------

You can now preview the DDL statements which will be run by Piccolo migrations.

.. code-block:: bash

piccolo migrations forwards my_app --preview

Thanks to AliSayyah for adding this feature.

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

0.83.0

Not secure
------

We added support for Postgres read-slaves a few releases ago, but the ``batch``
clause didn't support it until now. Thanks to guruvignesh01 for reporting
this issue, and sinisaos for help implementing it.

.. code-block:: python

Returns 100 rows at a time from read_replica_db
async with await Manager.select().batch(
batch_size=100,
node="read_replica_db",
) as batch:
async for _batch in batch:
print(_batch)


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

Page 10 of 48

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.