BTW thanks for the quick reply :)
Jose
Michael Bayer wrote:
> make sure the "threadlocal" mod is not imported anywhere in the  
> application.  or the "assignmapper" mod either.
>
>
> On Sep 19, 2006, at 12:25 AM, Jose Galvez wrote:
>
>   
>> Dear sqlalchemy users, I'm pretty new to sqlalchemy and I've run  
>> into a
>> problem that I cant seem to figure out.  Here is what I cant to do, I
>> have a table, wiith xml data in it.  What I want to do is try and look
>> up an entry in the table, and if I don't find it, add a new entry into
>> the database with the default xml data in it.  I thought I could do it
>> this way:
>>
>>             uin = dbsession.query(model.Wsi).get_by(uin=image)
>>             if uin:
>>                 xml = uin.xml
>>             else:
>>                 uin=model.Wsi()
>>                 uin.uin=image
>>                 xml = '<ZAS></ZAS>'
>>                 uin.xml = xml
>>                 dbsession.flush()
>>                 dbsession.save(uin)
>>
>> however when I do this I get an error saying the Wsi is already
>> associated with an other session (InvalidRequestError: Object
>> '<wsi.models.Wsi object at 0x016DE950>' is already attached to session
>> '23980720' (this is '23998864')).  I believe its the session that was
>> created with the first query, but I'm not sure how to recover that
>> session to use it rather then the one that I must be creating.  Any  
>> and
>> all help would be great
>>
>> Jose
>>
>> ---------------------------------------------------------------------- 
>> ---
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to  
>> share your
>> opinions on IT & business topics through brief surveys -- and earn  
>> cash
>> http://www.techsay.com/default.php? 
>> page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Sqlalchemy-users mailing list
>> Sqlalchemy-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>>     
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>
>
>   


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to