That's certainly the root cause, since each thread has it's own session in my config. Thanks!
Alex On 5 сент, 21:59, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Sep 5, 2008, at 1:48 PM, Alex K wrote: > > > > > > > Hi All, > > > I'm using sqlalchemy and mod_wsgi. mod_wsgi is set up to serve request > > in multiple threads of the same process. > > > class looks like that: > > > class WebSessionRoute(DeclarativeBase): > > > __tablename__ = 'web_session_route' > > > key = Column('key', Unicode(40), primary_key=True) > > user_id = Column('user_id',Integer, ForeignKey('user_route.id')), > > expires = Column('expires', DateTime) > > > def __init__(self,key,user_id,expires): > > self.key = key > > self.user_id = user_id > > self.expires = expires > > > I'm facing the following issue. The first request goes fine, but on > > the second attempt I get: > > > query.py, line 1620, in __init__ > > raise sa_exc.InvalidRequestError("Invalid column expression '%r'" > > % column) > > > on any attempt to execute any query. Instrumented attributes are in > > place, but they don't work. > > I've rewrote the code using regular mapper. If each thread maps the > > class to the table. everything is ok, > > Once I put the lock to make initialization only once per process, I > > get this error. > > > I would appreciate any feedback from you, > > Thanks in advance, > > this mostly depends on how you've configured Session access. Your > mappers, classes, and database engine should be configured at the > application level only, not per request, and you should be using > scoped_session() to manage one session per thread. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---