Piccolo

Latest version: v1.22.0

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

Scan your dependencies

Page 24 of 53

0.54.0

Not secure
------
Added the ``db_column_name`` option to columns. This is for edge cases where
a legacy database is being used, with problematic column names. For example,
if a column is called ``class``, this clashes with a Python builtin, so the
following isn't possible:

.. code-block:: text

class MyTable(Table):
class = Varchar() Syntax error!

You can now do the following:

.. code-block:: python

class MyTable(Table):
class_ = Varchar(db_column_name='class')

Here are some example queries using it:

.. code-block:: python

Create - both work as expected
MyTable(class_='Test').save().run_sync()
MyTable.objects().create(class_='Test').run_sync()

Objects
row = MyTable.objects().first().where(MyTable.class_ == 'Test').run_sync()
>>> row.class_
'Test'

Select
>>> MyTable.select().first().where(MyTable.class_ == 'Test').run_sync()
{'id': 1, 'class': 'Test'}

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

0.53.0

Not secure
------
An internal code clean up (courtesy yezz123).

Dramatically improved CLI appearance when running migrations (courtesy
wmshort).

Added a runtime reflection feature, where ``Table`` classes can be generated
on the fly from existing database tables (courtesy AliSayyah). This is useful
when dealing with very dynamic databases, where tables are frequently being
added / modified, so hard coding them in a ``tables.py`` is impractical. Also,
for exploring databases on the command line. It currently just supports
Postgres.

Here's an example:

.. code-block:: python

from piccolo.table_reflection import TableStorage

storage = TableStorage()
Band = await storage.get_table('band')
>>> await Band.select().run()
[{'id': 1, 'name': 'Pythonistas', 'manager': 1}, ...]

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

0.52.0

Not secure
------
Lots of improvements to ``piccolo schema generate``:

* Dramatically improved performance, by executing more queries in parallel
(courtesy AliSayyah).
* If a table in the database has a foreign key to a table in another
schema, this will now work (courtesy AliSayyah).
* The column defaults are now extracted from the database (courtesy wmshort).
* The ``scale`` and ``precision`` values for ``Numeric`` / ``Decimal`` column
types are extracted from the database (courtesy wmshort).
* The ``ON DELETE`` and ``ON UPDATE`` values for ``ForeignKey`` columns are
now extracted from the database (courtesy wmshort).

Added ``BigSerial`` column type (courtesy aliereno).

Added GitHub issue templates (courtesy AbhijithGanesh).

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

0.51.1

Not secure
------
Fixing a bug with ``on_delete`` and ``on_update`` not being set correctly.
Thanks to wmshort for discovering this.

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

0.51.0

Not secure
------
Modified ``create_pydantic_model``, so ``JSON`` and ``JSONB`` columns have a
``format`` attribute of ``'json'``. This will be used by Piccolo Admin for
improved JSON support. Courtesy sinisaos.

Fixing a bug where the ``piccolo fixtures load`` command wasn't registered
with the Piccolo CLI.

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

0.50.0

Not secure
------
The ``where`` clause can now accept multiple arguments (courtesy AliSayyah):

.. code-block:: python

Concert.select().where(
Concert.venue.name == 'Royal Albert Hall',
Concert.band_1.name == 'Pythonistas'
).run_sync()

It's another way of expressing `AND`. It's equivalent to both of these:

.. code-block:: python

Concert.select().where(
Concert.venue.name == 'Royal Albert Hall'
).where(
Concert.band_1.name == 'Pythonistas'
).run_sync()

Concert.select().where(
(Concert.venue.name == 'Royal Albert Hall') & (Concert.band_1.name == 'Pythonistas')
).run_sync()

Added a ``create`` method, which is an easier way of creating objects (courtesy
AliSayyah).

.. code-block:: python

This still works:
band = Band(name="C-Sharps", popularity=100)
band.save().run_sync()

But now we can do it in a single line using `create`:
band = Band.objects().create(name="C-Sharps", popularity=100).run_sync()

Fixed a bug with ``piccolo schema generate`` where columns with unrecognised
column types were omitted from the output (courtesy AliSayyah).

Added docs for the ``--trace`` argument, which can be used with Piccolo
commands to get a traceback if the command fails (courtesy hipertracker).

Added ``DoublePrecision`` column type, which is similar to ``Real`` in that
it stores ``float`` values. However, those values are stored at greater
precision (courtesy AliSayyah).

Improved ``AppRegistry``, so if a user only adds the app name (e.g. ``blog``),
instead of ``blog.piccolo_app``, it will now emit a warning, and will try to
import ``blog.piccolo_app`` (courtesy aliereno).

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

Page 24 of 53

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.