You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have an asynchronous connection() method because we need to make an asynchronous call to the database pool.
When we get a connection that can be used in a context manager, it must have some magical method and access to the ConnectionPool.
If we want to have 2 ways of connection declaration, we need to be available to start it explicitly, like Transaction has a begin method.
Example:
# First without context manager
...
conn=connection_pool.connection()
awaitconn.start()
# Second with a context manager
...
asyncwithconnection_pool.connection() asconn:
It seems a bit complicated to me with some start method for connection.
If you have another opinion please share it.
ATM to use connection we need to write the following code:
But it would be more pythonic to use context manager here like:
The text was updated successfully, but these errors were encountered: