[sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-10 Thread Kent
Thanks for the ticket 1681 consideration. Though my understanding of the software isn't strong enough to recommend (or understand) what you are suggesting in 1681, I can observe the behavior enough to wonder why do we need to go back to the database again? (Also, wondering if some databases

Re: [sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 8:36 AM, Kent wrote: I've researched this in the past and they don't. I will look into re-introducing allow_null_pks as a new flag allow_partial_pks, defaults to True, will be honored by merge(), you set yours to False. this is 0.6 only. Thanks for your

[sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-10 Thread Kent
When I do something simple like this script: o=Order() o.orderid = 'KBORDE' ol=OrderDetail() ol.lineid=1 # exists in database o.orderdetails=[ol] mo=DBSession.merge(o) mo.orderdetails[0] in DBSession.new mo.orderdetails[0].saleprice = 65 DBSession.flush() (output pasted below)= I

Re: [sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 7:10 PM, Kent wrote: When I do something simple like this script: o=Order() o.orderid = 'KBORDE' ol=OrderDetail() ol.lineid=1 # exists in database o.orderdetails=[ol] mo=DBSession.merge(o) mo.orderdetails[0] in DBSession.new mo.orderdetails[0].saleprice = 65

[sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-09 Thread Kent
I am on version 0.5.8. As far as how upset it is making me: well, I certainly have no right to demand this very nice, free software be enhanced or changed: I'm just grateful for it. We will be supporting clients on webservers that are removed by a long distance from the database server, so I

Re: [sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-09 Thread Michael Bayer
Kent wrote: I am on version 0.5.8. part of your issue is this: line1.lineid = '15' should be this: line1.lineid = 15 This because the value comes back from the DB as a numeric, not a string, producing the wrong identity key ( (class '__main__.OrderDetail', ('0206001A134', '15')) vs (class

[sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-09 Thread Kent
Ah ha. Thanks for tracking that down, makes sense. On Feb 9, 2:25 pm, Michael Bayer mike...@zzzcomputing.com wrote: Kent wrote: I am on version 0.5.8. part of your issue is this: line1.lineid = '15' should be this: line1.lineid = 15 This because the value comes back from the DB as a

[sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-09 Thread Kent
Maybe you're still looking into that, but I still don't understand why this: merged.orderdetails[0].saleprice causes a new issue to the database. (Also, wondering if some databases allow a primary key to be null...) Thanks again. On Feb 9, 2:50 pm, Kent k...@retailarchitects.com wrote: Ah

Re: [sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-09 Thread Michael Bayer
Kent wrote: Maybe you're still looking into that, but I still don't understand why this: merged.orderdetails[0].saleprice causes a new issue to the database. as I mentioned earlier, if the value isn't in __dict__ on a persistent instance, it will be loaded when accessed. Your example

Re: [sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-09 Thread Michael Bayer
On Feb 9, 2010, at 7:09 PM, Michael Bayer wrote: Kent wrote: Maybe you're still looking into that, but I still don't understand why this: merged.orderdetails[0].saleprice causes a new issue to the database. as I mentioned earlier, if the value isn't in __dict__ on a persistent