Skip to content

Commit

Permalink
bumped version
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend committed Sep 21, 2024
1 parent e36a9ed commit 0f4716f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
50 changes: 50 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,56 @@
Changes
=======

1.18.0
------

``update_self``
~~~~~~~~~~~~~~~

Added the ``update_self`` method, which is an alternative to the ``save``
method. Here's an example where it's useful:

.. code-block:: python
# If we have a band object:
>>> band = Band.objects().get(name="Pythonistas")
>>> band.popularity
1000
# We can increment the popularity, based on the current value in the
# database:
>>> await band.update_self({
... Band.popularity: Band.popularity + 1
... })
# The new value is set on the object:
>>> band.popularity
1001
# It's safer than using the `save` method, because the popularity value on
# the object might be out of date with what's in the database:
band.popularity += 1
await band.save()
Thanks to @trondhindenes for suggesting this feature.

Batch raw queries
~~~~~~~~~~~~~~~~~

The ``batch`` method can now be used with ``raw`` queries. For example:

.. code-block:: python
async with await MyTable.raw("SELECT * FROM my_table").batch() as batch:
async for _batch in batch:
print(_batch)
This is useful when you expect a raw query to return a lot of data.

Thanks to @devsarvesh92 for suggesting this feature.

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

1.17.1
------

Expand Down
2 changes: 1 addition & 1 deletion piccolo/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__VERSION__ = "1.17.1"
__VERSION__ = "1.18.0"

0 comments on commit 0f4716f

Please sign in to comment.