Some googling didn't turn up a definitive answer if a single OCI connection can persist, while its underlying "session" is killed. I found http://www.dbametrix.com/kill-session-oracle-11g.html but this doesn't seem like something you can call regularly.
As for cx_oracle itself, it offers the opposite behavior, that you can "pool" sessions using a SessionPool:
http://cx-oracle.sourceforge.net/html/module.html#cx_Oracle.SessionPool
and also the usage of Sessions can be customized when a new connection is created:
http://cx-oracle.sourceforge.net/html/module.html#database-resident-connection-pooling
Once you decide how you'd like connections to cx_oracle to occur, the venues you have in SQLAlchemy for this are:
1. Disable SQLAlchemy connection pooling using NullPool. If you can get cx_oracle's connect() method to do what you want as far as pooling, you can turn of the pool on the SQLAlchemy side using NullPool.
http://www.sqlalchemy.org/docs/core/pooling.html#switching-pool-implementations
2. 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.
http://www.sqlalchemy.org/docs/core/pooling.html#using-a-custom-connection-function
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
You should first get some help for cx_oracle specifically, their list is at https://lists.sourceforge.net/lists/listinfo/cx-oracle-users . There, just ask them about how to do what you're looking for at the cx_oracle level directly. If you mention SQLAlchemy it will scare them away :).
Then come back over here and we can connect up their recommendations with the SQLAlchemy API.
> --
> You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
> To post to this group, send email to sqlal...@googlegroups.com.
> To unsubscribe from this group, send email to sqlalchemy+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
>
>
> 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 MapperTo 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+...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/e9e325d2-ac0e-47da-870f-6985d0e210c4n%40googlegroups.com.