I have tried below approach in SQLAlchemy 1.3.16.

Use a creator function - if you need to use special form when calling 
cx_oracle.connect(), a creator function will allow you to plug into the 
Engine how cx_oracle connections are established.

The creator function, that i associated would internally perform a 
cx_Oracle.SessionPool.acquire(), where SessionPool is created with a fixed 
number of static connections.
How can we ensure that the connections are released and reused from this 
SessionPool when using SQLAlchemy Session object in a flask application 
across API requests?

Thanks,
Anupama
On Wednesday, December 9, 2020 at 5:52:26 PM UTC-7 Anupama Goparaju wrote:

> Hi.
>
> I would like to know how to use a cx-oracle SessionPool with SQLAlchemy.
> We are leveraging the Session object of SQLAlchemy but we would like to 
> use the driver level pooling instead of SQLAlchemy pool.
> Please advise.
>
> Thanks,
> Anupama
>
> On Monday, October 3, 2011 at 12:23:58 PM UTC-6 Mike Bayer wrote:
>
>>
>> On Oct 3, 2011, at 2:20 PM, Michael Bayer wrote:
>>
>> > 
>> > 3. Use pool events to emit commands when connections are checked out or 
>> checked in. If you need to emit some SQL or cx_oracle commands on the DBAPI 
>> connection upon checkout or checkin, the Engine provides pool events which 
>> accomplish this. They work with NullPool as well as the regular QueuePool.
>> > 
>> > http://www.sqlalchemy.org/docs/core/events.html#connection-pool-events
>>
>> in 0.6 you'd use PoolListener, same idea just older API:
>>
>>
>> http://www.sqlalchemy.org/docs/06/core/interfaces.html#connection-pool-events
>>
>>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/34851672-66ae-424e-b0d4-3cbdaeb369fan%40googlegroups.com.

Reply via email to