Skip to content

Commit 0f4716f

Browse files
committed
bumped version
1 parent e36a9ed commit 0f4716f

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

CHANGES.rst

+50
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,56 @@
11
Changes
22
=======
33

4+
1.18.0
5+
------
6+
7+
``update_self``
8+
~~~~~~~~~~~~~~~
9+
10+
Added the ``update_self`` method, which is an alternative to the ``save``
11+
method. Here's an example where it's useful:
12+
13+
.. code-block:: python
14+
15+
# If we have a band object:
16+
>>> band = Band.objects().get(name="Pythonistas")
17+
>>> band.popularity
18+
1000
19+
20+
# We can increment the popularity, based on the current value in the
21+
# database:
22+
>>> await band.update_self({
23+
... Band.popularity: Band.popularity + 1
24+
... })
25+
26+
# The new value is set on the object:
27+
>>> band.popularity
28+
1001
29+
30+
# It's safer than using the `save` method, because the popularity value on
31+
# the object might be out of date with what's in the database:
32+
band.popularity += 1
33+
await band.save()
34+
35+
Thanks to @trondhindenes for suggesting this feature.
36+
37+
Batch raw queries
38+
~~~~~~~~~~~~~~~~~
39+
40+
The ``batch`` method can now be used with ``raw`` queries. For example:
41+
42+
.. code-block:: python
43+
44+
async with await MyTable.raw("SELECT * FROM my_table").batch() as batch:
45+
async for _batch in batch:
46+
print(_batch)
47+
48+
This is useful when you expect a raw query to return a lot of data.
49+
50+
Thanks to @devsarvesh92 for suggesting this feature.
51+
52+
-------------------------------------------------------------------------------
53+
454
1.17.1
555
------
656

piccolo/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__VERSION__ = "1.17.1"
1+
__VERSION__ = "1.18.0"

0 commit comments

Comments
 (0)