Introduction¶
The PySQLXEngine is a library that allows you to connect to a database and execute queries in a simple way.
So you can use it to create, read, update and delete data in your database.
Since the beginning PySQLXEngine was created and thinking to be a totally async
engine.
Although Python has supported asynchronous programming since version 3.5*
using async/await
.
We currently don't have good async
libraries to handle SQL Server asynchronously, for example.
Despite being designed to be async
, PySQLXEngine has sync support as well. The classes PySQLXEngine
and PySQLXEngineSync
are made available.
Both async
and sync
classes have precisely the same methods.
Providers/Drivers¶
URIs¶
Example of use async and sync¶
In a way, the code's only change would be the word async/await
.
Asynchronous programming is a broad subject, but our tutorial is intended to be objective. So, in summary,
when you need a performance in the sense of doing concurrency "at the same time", use async
.
You can use the sync form something need to do things that don't need concurrency.
Create the file¶
Create a file called main.py
and add the code below.
Calling the functions¶
To call the coroutine functions, you need to use the asyncio
library, this library is part of the standard library of Python.
So, you need to add the below lines at the end of your code!
Running the code¶
Running the code using the terminal