i have problem sql alchemy 0.8.1 on python 2.7 running on linux box via mod_wsgi. time time produces "invalidrequesterror: session in 'prepared' state; no further sql can emitted within transaction".
below detailed stack trace of error:
... file "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2173, in 1 ret = list(self) self = <sqlalchemy.orm.query.query object @ 0x7f6f64348dd0> file "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2216, in __iter__ return self._execute_and_instances(context) self = <sqlalchemy.orm.query.query object @ 0x7f6f64348dd0> context = <sqlalchemy.orm.query.querycontext object @ 0x7f6f64348d50> file "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2229, in _execute_and_instances close_with_result=true) querycontext = <sqlalchemy.orm.query.querycontext object @ 0x7f6f64348d50> self = <sqlalchemy.orm.query.query object @ 0x7f6f64348dd0> file "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2220, in _connection_from_session **kw) self = <sqlalchemy.orm.query.query object @ 0x7f6f64348dd0> kw = {'clause': , 'close_with_result': true, 'mapper': } file "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 798, in connection close_with_result=close_with_result) mapper = clause = <sqlalchemy.sql.expression.select @ 0x7f6f64348d90; select object> self = <sqlalchemy.orm.session.session object @ 0x7f6f68f6fe50> kw = {} bind = engine(mysql+mysqldb://xxx:yyy@localhost/zzz?charset=utf8) close_with_result = true file "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 802, in _connection_for_bind return self.transaction._connection_for_bind(engine) engine = engine(mysql+mysqldb://xxx:yyy@localhost/zzz?charset=utf8) self = <sqlalchemy.orm.session.session object @ 0x7f6f68f6fe50> kwargs = {'close_with_result': true} file "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 281, in _connection_for_bind self._assert_active() bind = engine(mysql+mysqldb://xxx:yyy@localhost/zzz?charset=utf8) self = <sqlalchemy.orm.session.sessiontransaction object @ 0x7f6f69be8050> file "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 181, in _assert_active "this session in 'prepared' state; no further " rollback_ok = false prepared_ok = false closed_msg = 'this transaction closed' self = <sqlalchemy.orm.session.sessiontransaction object @ 0x7f6f69be8050> invalidrequesterror: session in 'prepared' state; no further sql can emitted within transaction.
this error happens @ random - may take few days see or might happen after 5 minutes. cannot understand causes , biggest problem - don't understand error means. 'prepared' state? documentation has no information on state. saw has relation two-way transactions not use them in code. use session.query , session.commit.
any appreciated.
i'm guessing here, think maybe you're using threads wsgi deployment, , session instance not thread local. can of course, follow short tutorial in official documentation:
Comments
Post a Comment