I'm new to SQLAlchemy and don't understand how I can maintain my
connections to Postgres over long periods of time... (or reestablish
them automatically).  I am getting this error after my web application
sits idle for long periods of time.  I am using scopedSession() and
and creating the engine like so...

engine = create_engine(connstring, echo=echo, pool_recycle=20000,
poolclass=QueuePool, pool_size=5)

This is the error after timing out...

results =
scopedSession().query(ExceptionPageRequest).filter(ExceptionPageRequest.owned_by_id
== fg_id ).filter(ExceptionPageRequest.status == None).all()
  File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/
sqlalchemy/orm/query.py", line 1576, in all
    return list(self)
  File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/
sqlalchemy/orm/query.py", line 1688, in __iter__
    return self._execute_and_instances(context)
  File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/
sqlalchemy/orm/query.py", line 1693, in _execute_and_instances
    mapper=self._mapper_zero_or_none())
  File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/
sqlalchemy/orm/session.py", line 729, in execute
    clause, params or {})
  File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/
sqlalchemy/engine/base.py", line 1191, in execute
    params)
  File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/
sqlalchemy/engine/base.py", line 1271, in _execute_clauseelement
    return self.__execute_context(context)
  File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/
sqlalchemy/engine/base.py", line 1302, in __execute_context
    context.parameters[0], context=context)
  File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/
sqlalchemy/engine/base.py", line 1401, in _cursor_execute
    context)
  File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/
sqlalchemy/engine/base.py", line 1394, in _cursor_execute
    context)
  File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/
sqlalchemy/engine/default.py", line 299, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (OperationalError) could not receive
data from server: Operation timed out

Thanks ahead of time :)

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to