|
1 | 1 | Changes |
2 | 2 | ======= |
3 | 3 |
|
| 4 | +1.28.0 |
| 5 | +------ |
| 6 | + |
| 7 | +Playground improvements |
| 8 | +~~~~~~~~~~~~~~~~~~~~~~~ |
| 9 | + |
| 10 | +* Added an ``Array`` column to the playground (``Album.awards``), for easier |
| 11 | + experimentation with array columns. |
| 12 | +* CoachroachDB is now supported in the playground (thanks to @sinisaos for this). |
| 13 | + |
| 14 | + .. code-block:: bash |
| 15 | +
|
| 16 | + piccolo playground run --engine=cockroach |
| 17 | +
|
| 18 | +Functions |
| 19 | +~~~~~~~~~ |
| 20 | + |
| 21 | +Added lots of useful array functions (thanks to @sinisaos for this). |
| 22 | + |
| 23 | +Here's an example, where we can easily fix a typo in an array using ``replace``: |
| 24 | + |
| 25 | +.. code-block:: python |
| 26 | +
|
| 27 | + >>> await Album.update({ |
| 28 | + ... Album.awards: Album.awards.replace('Grammy Award 2021', 'Grammy Award 2022') |
| 29 | + ... }, force=True) |
| 30 | +
|
| 31 | +The documentation for functions has also been improved (e.g. how to create a |
| 32 | +custom function). |
| 33 | + |
| 34 | +The ``Cast`` function is now more flexible. |
| 35 | + |
| 36 | +``Array`` concantenation |
| 37 | +~~~~~~~~~~~~~~~~~~~~~~~~ |
| 38 | + |
| 39 | +Values can be prepended: |
| 40 | + |
| 41 | +.. code-block:: python |
| 42 | +
|
| 43 | + >>> await Album.update({ |
| 44 | + ... Album.awards: ['Grammy Award 2020'] + Album.awards |
| 45 | + ... }, force=True) |
| 46 | +
|
| 47 | +And multiple arrays can be concatenated in one go: |
| 48 | + |
| 49 | +.. code-block:: python |
| 50 | +
|
| 51 | + >>> await Album.update({ |
| 52 | + ... Album.awards: ['Grammy Award 2020'] + Album.awards + ['Grammy Award 2025'] |
| 53 | + ... }, force=True) |
| 54 | +
|
| 55 | +``is_in`` and ``not_in`` sub queries |
| 56 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 57 | + |
| 58 | +You can now use sub queries within ``is_in`` and ``not_in`` Thanks to |
| 59 | +@sinisaos for this. |
| 60 | + |
| 61 | +.. code-block:: python |
| 62 | +
|
| 63 | + >>> await Band.select().where( |
| 64 | + ... Band.id.is_in( |
| 65 | + ... Concert.select(Concert.band_1).where( |
| 66 | + ... Concert.starts >= datetime.datetime(year=2025, month=1, day=1) |
| 67 | + ... ) |
| 68 | + ... ) |
| 69 | + ... ) |
| 70 | +
|
| 71 | +Other improvements |
| 72 | +~~~~~~~~~~~~~~~~~~ |
| 73 | + |
| 74 | +* Auto convert a default value of ``0`` to ``0.0`` in ``Float`` columns. |
| 75 | +* Modernised the type hints throughout the codebase (e.g. using ``list`` |
| 76 | + instead of ``typing.List``). Thanks to @sinisaos for this. |
| 77 | +* Fixed a bug with auto migrations, where the ``Array`` base column class |
| 78 | + wasn't being imported. |
| 79 | +* Improved M2M query performance by using sub selects (thanks to @sinisaos for |
| 80 | + this). |
| 81 | + |
| 82 | +------------------------------------------------------------------------------- |
| 83 | + |
4 | 84 | 1.27.1 |
5 | 85 | ------ |
6 | 86 |
|
|
0 commit comments