File: examples.rst

package info (click to toggle)
aiomysql 0.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 912 kB
  • sloc: python: 6,894; makefile: 213
file content (38 lines) | stat: -rw-r--r-- 943 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Examples of aiomysql usage
==========================

Below is a list of examples from `aiomysql/examples
<https://github.com/aio-libs/aiomysql/tree/master/examples>`_

Every example is a correct tiny python program that demonstrates specific
feature of library.

.. _aiomysql-examples-simple:

Low-level API
-------------
Basic example, fetch host and user information from internal table: user.

.. literalinclude:: ../examples/example.py

Example of stored procedure, which just increments input value.

.. literalinclude:: ../examples/example_callproc.py

Example of using `executemany` method:

.. literalinclude:: ../examples/example_executemany.py

Example of using transactions `rollback` and `commit` methods:

.. literalinclude:: ../examples/example_transaction.py

Example of using connection pool:

.. literalinclude:: ../examples/example_pool.py


sqlalchemy usage
----------------

.. literalinclude:: ../examples/example_sa.py