I am using sqlalchemy 0.9.8 on python 2.7 with Oracle database. I tried
thread local strategy since we have lot of code acquiring a connection
without closing the current ones, assuming that the new connection will be
the same one as currently checked out connection. However, when I tested
the following code, it wait on the seconds time acquiring connection from
engine until timing out. It is the same thing when I tried
contextual_connect instead of raw_connection. is there anything wrong with
my code?
from sqlalchemy import create_engine
def _main():
conn_str = ''
engine = create_engine(conn_str, pool_size=1, max_overflow=0,
pool_recycle=5, strategy='threadlocal')
conn=engine.raw_connection()
cur = conn.cursor()
cur.execute('insert into wugang_test values(1)')
cur.execute('commit')
# conn.close()
conn = engine.raw_connection()
cur = conn.cursor()
for r in cur.execute('select * from wugang_test'):
print r
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.