| 1 |
Examples of aiomysql usage |
| 2 |
========================== |
| 3 |
|
| 4 |
Below is a list of examples from `aiomysql/examples |
| 5 |
<https://github.com/aio-libs/aiomysql/tree/main/examples>`_ |
| 6 |
|
| 7 |
Every example is a correct tiny python program that demonstrates specific |
| 8 |
feature of library. |
| 9 |
|
| 10 |
.. _aiomysql-examples-simple: |
| 11 |
|
| 12 |
Low-level API |
| 13 |
------------- |
| 14 |
Basic example, fetch host and user information from internal table: user. |
| 15 |
|
| 16 |
.. literalinclude:: ../examples/example.py |
| 17 |
|
| 18 |
Example of stored procedure, which just increments input value. |
| 19 |
|
| 20 |
.. literalinclude:: ../examples/example_callproc.py |
| 21 |
|
| 22 |
Example of using `executemany` method: |
| 23 |
|
| 24 |
.. literalinclude:: ../examples/example_executemany.py |
| 25 |
|
| 26 |
Example of using transactions `rollback` and `commit` methods: |
| 27 |
|
| 28 |
.. literalinclude:: ../examples/example_transaction.py |
| 29 |
|
| 30 |
Example of using connection pool: |
| 31 |
|
| 32 |
.. literalinclude:: ../examples/example_pool.py |
| 33 |
|
| 34 |
|
| 35 |
sqlalchemy usage |
| 36 |
---------------- |
| 37 |
|
| 38 |
.. literalinclude:: ../examples/example_simple_sa.py |