On Dec 8, 2011, at 4:26 PM, John Hufnagle wrote:

> I've been beating my head over this one.  I read the ORM Creating a
> Thread-local Context doc and the web but don't see a simple
> answer...saw some old SA/Cherrypy code that used cherrypy 'tools' etc.
> The SA doc  seems straightforward but I keep getting
> sqlalchemy.exc.UnboundExecutionError errors.
> My in my cherrypy application startup code I do:
> 
> 
> engine = create_engine('mysql://xxxxxxxx@localhost/test', echo=True)
> Session = scoped_session(sessionmaker(bind=engine))
> ...
> create cherrypy root object and sit and wait for a request
> 
> In my request handler (REST type)
> 
> I call:
> fld = ProjectORM
> session = Session()
> session.query(ProjectORM).filter(ProjectORM == 12).one()
> 
> ....
> When I issue a request that goes through the above 3 lines
> I get a:
> UnboundExecutionError: Could not locate a bind configured on mapper
> Mapper|ProjectORM|project, SQL expression or this Session

seems like you have something else going on .    If you make 
scoped_session(sessionmaker(bind=engine)), any Session you get from there has 
an engine, guaranteed.  I'd poke around and look for another variable named 
Session somewhere.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.

Reply via email to