@@ -9,6 +9,8 @@ ORMs which support asyncio.
99However, you can use Piccolo in synchronous apps as well, whether that be a
1010WSGI web app, or a data science script.
1111
12+ -------------------------------------------------------------------------------
13+
1214Sync example
1315------------
1416
@@ -24,6 +26,8 @@ Sync example
2426 if __name__ == ' __main__' :
2527 main()
2628
29+ -------------------------------------------------------------------------------
30+
2731Async example
2832-------------
2933
@@ -40,6 +44,22 @@ Async example
4044 if __name__ == ' __main__' :
4145 asyncio.run(main())
4246
47+ Direct await
48+ ~~~~~~~~~~~~
49+
50+ You can directly await a query if you prefer. For example:
51+
52+ .. code-block :: python
53+
54+ >> > await Band.select()
55+ [{' id' : 1 , ' name' : ' Pythonistas' , ' manager' : 1 , ' popularity' : 1000 },
56+ {' id' : 2 , ' name' : ' Rustaceans' , ' manager' : 2 , ' popularity' : 500 }]
57+
58+ By convention, we await the ``run `` method (``await Band.select().run() ``), but
59+ you can use this shorter form if you prefer.
60+
61+ -------------------------------------------------------------------------------
62+
4363Which to use?
4464-------------
4565
@@ -50,6 +70,8 @@ Using the async version is useful for web applications which require high
5070throughput, based on `ASGI frameworks <https://piccolo-orm.com/blog/introduction-to-asgi >`_.
5171Piccolo makes building an ASGI web app really simple - see :ref: `ASGICommand `.
5272
73+ -------------------------------------------------------------------------------
74+
5375Explicit
5476--------
5577
0 commit comments