Comments (4)
Hi,
the simplest solution for this that would require no code changes is to just acquire()
a connection from the pool for each task.
By providing appropriate minsize
and maxsize
values the pool will automatically take care of creating the necessary amount of connections and it will not return on acquire()
until a connection is available.
from aiomysql.
I don't think this is solution will work if need to work within the same connection transaction, which is my requirement.
On our server, we use a connection per request where each connection is also a transaction we can rollback if the request fails (due to an exception or other error).
from aiomysql.
Indeed, transactions will get lost with that.
from aiomysql.
Any progress on this? An asyncio.Lock
is an elegant solution that is easy to implement. I'm willing to contribute a PR if necessary, I just want to make sure it will get quickly reviewed if I spend the time on this.
from aiomysql.
Related Issues (20)
- Support SQLAlchemy 1.4
- UNION in SQL causes TypeError: Argument 'val' has incorrect type (expected tuple, got list), in converters.pyx line 23, in asyncmy.converters.escape_item HOT 2
- `set-output` in GHA workflow is deprecated
- Better documentation on how connection/cursor work
- The program is blocked for unknown reasons, causing other protocols to fail to run HOT 1
- Connection created from pool is never closed to success after `with` block HOT 2
- Is there any way to release inactive connection?
- Please, type hint this library. HOT 1
- Pre ping failing with uvloop HOT 1
- No fast-track for bulk inserts in Cursor.executemany with INSERT/REPLACE syntax introduced in MySQL 8.0.19
- INSERT into json column on MySQL 8 fails
- Get InternalError: Packet sequence number wrong - got 1 expected 2 HOT 1
- aiomysql returns wrong data when calling pool.acquire multiple times HOT 3
- Similarly, the query results of the sql statements aiomysql and navicat are inconsistent(同样sql语句aiomysql和navicat查询结果不一致) HOT 1
- aiomysql does not work with ssl, but pymysql does work HOT 1
- aiomysql raise InvalidRequestError: Cannot release a connection with not finished transaction
- aiomysql executemany is very slow to insert HOT 4
- 返回的连接对象的游标对象执行sql语句的时候发生了bug
- How to initialize a database connection only once when deploying services using FastAPI HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiomysql.