File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 11Changes
22=======
33
4+ 0.24.0
5+ ------
6+ Lots of improvements to ``JSON`` and ``JSONB`` columns. Piccolo will now
7+ automatically convert between Python types and JSON strings. For example, with
8+ this schema:
9+
10+ .. code-block:: python
11+
12+ class RecordingStudio(Table):
13+ name = Varchar()
14+ facilities = JSON()
15+
16+ We can now do the following:
17+
18+ .. code-block:: python
19+
20+ RecordingStudio(
21+ name="Abbey Road",
22+ facilities={'mixing_desk': True} # Will automatically be converted to a JSON string
23+ ).save().run_sync()
24+
25+ Similarly, when fetching data from a JSON column, Piccolo can now automatically
26+ deserialise it.
27+
28+ .. code-block:: python
29+
30+ >>> RecordingStudio.select().output(load_json=True).run_sync()
31+ [{'id': 1, 'name': 'Abbey Road', 'facilities': {'mixing_desk': True}]
32+
33+ >>> studio = RecordingStudio.objects().first().output(load_json=True).run_sync()
34+ >>> studio.facilities
35+ {'mixing_desk': True}
36+
4370.23.0
538------
639Added the ``create_table_class`` function, which can be used to create
Original file line number Diff line number Diff line change 1- __VERSION__ = "0.23 .0"
1+ __VERSION__ = "0.24 .0"
You can’t perform that action at this time.
0 commit comments