Piccolo

Latest version: v1.22.0

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

Scan your dependencies

Page 22 of 53

0.62.0

Not secure
------

Added Many-To-Many support.

.. code-block:: python

from piccolo.columns.column_types import (
ForeignKey,
LazyTableReference,
Varchar
)
from piccolo.columns.m2m import M2M


class Band(Table):
name = Varchar()
genres = M2M(LazyTableReference("GenreToBand", module_path=__name__))


class Genre(Table):
name = Varchar()
bands = M2M(LazyTableReference("GenreToBand", module_path=__name__))


This is our joining table:
class GenreToBand(Table):
band = ForeignKey(Band)
genre = ForeignKey(Genre)


>>> await Band.select(Band.name, Band.genres(Genre.name, as_list=True))
[
{
"name": "Pythonistas",
"genres": ["Rock", "Folk"]
},
...
]

See the docs for more details.

Many thanks to sinisaos and yezz123 for all the input.

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

0.61.2

Not secure
------

Fixed some edge cases where migrations would fail if a column name clashed with
a reserved Postgres keyword (for example ``order`` or ``select``).

We now have more robust tests for ``piccolo asgi new`` - as part of our CI we
actually run the generated ASGI app to make sure it works (thanks to AliSayyah
and yezz123 for their help with this).

We also improved docstrings across the project.

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

0.61.1

Not secure
------

Nicer ASGI template
~~~~~~~~~~~~~~~~~~~

When using ``piccolo asgi new`` to generate a web app, it now has a nicer home
page template, with improved styles.

Improved schema generation
~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixed a bug with ``piccolo schema generate`` where it would crash if the column
type was unrecognised, due to failing to parse the column's default value.
Thanks to gmos for reporting this issue, and figuring out the fix.

Fix Pylance error
~~~~~~~~~~~~~~~~~

Added ``start_connection_pool`` and ``close_connection_pool`` methods to the
base ``Engine`` class (courtesy gmos).

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

0.61.0

Not secure
------

The ``save`` method now supports a ``columns`` argument, so when updating a
row you can specify which values to sync back. For example:

.. code-block:: python

band = await Band.objects().get(Band.name == "Pythonistas")
band.name = "Super Pythonistas"
await band.save([Band.name])

Alternatively, strings are also supported:
await band.save(['name'])

Thanks to trondhindenes for suggesting this feature.

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

0.60.2

Not secure
------

Fixed a bug with ``asyncio.gather`` not working with some query types. It was
due to them being dataclasses, and they couldn't be hashed properly. Thanks to
brnosouza for reporting this issue.

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

0.60.1

Not secure
------

Modified the import path for ``MigrationManager`` in migration files. It was
confusing Pylance (VSCode's type checker). Thanks to gmos for reporting and
investigating this issue.

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

Page 22 of 53

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.