On Mar 31, 2008, at 4:18 PM, johnnyice wrote:

>
> I've been using 
> http://wiki.pylonshq.com/display/pylonsdocs/Using+SQLAlchemy+with+Pylons
> to help with the migration because the migration tutorial on
> SQLAlchemy (http://www.sqlalchemy.org/docs/04/
> intro.html#overview_migration) only included a partial list of things
> that I would need to change in my app.
>
> I finally got the app working with selects (I can view different
> categories, etc.).  However, write queries to the database is a
> different story.
>
>
> While following the tutorial I'm defining a transactional connection
> as follows:
>    sm = orm.sessionmaker(autoflush=True, transactional=True,
> bind=engine)
>
> As the tutorial says, sometimes you use save(), like when creating a
> new instance, and other times you don't, like when doing updates.
>
> I've been trying different combinations of the code below, but keep
> getting the following error (where XXX is a random number):
> InvalidRequestError: Instance '[EMAIL PROTECTED]' is already persistent

use save_or_update().  At the same time, make sure you aren't getting  
confused as to where you're getting Heading from, and *definitely* do  
*not* use the ScopedSession.mapper extension, which is going to auto- 
save things, since this kind of confusion is why that extension is  
awful.



--~--~---------~--~----~------------~-------~--~----~
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