[sqlalchemy] Re: Objects are wrongly getting removed/expunged from session

2011-01-15 Thread Tvrtko
On Jan 15, 11:56 am, Tvrtko qvx3...@gmail.com wrote: First, let me say that I'm using sqlalchemy version 0.5.8. We have a large and complex application and changing to sa 0.6 is expensive, so I would like, if possible, to find a solution for 0.5. I'm using sqlalchemy since version 0.1

[sqlalchemy] Re: Objects are wrongly getting removed/expunged from session

2011-01-15 Thread Tvrtko
I've drilled down all the way up to `mapper._save_obj()`. I examined the `state.dict` for `qitem`. Good case: qitem state dict = {'campaign': Campaign 233, u'Test', 'campaign_id': 233, ...} And for the bad case: qitem state dict = {'campaign': Campaign 234, u'Test', 'campaign_id':

[sqlalchemy] Re: Objects are wrongly getting removed/expunged from session

2011-01-15 Thread Tvrtko
no effect qitem.campaign_id = campaign.id # need flush for id I have to call flush() before I have an ID. On Jan 15, 2011, at 9:27 AM, Tvrtko wrote: I've drilled down all the way up to `mapper._save_obj()`. I examined the `state.dict` for `qitem`. Good case:    qitem state dict

[sqlalchemy] Re: Objects are wrongly getting removed/expunged from session

2011-01-15 Thread Tvrtko
campaign_id. I guess I will try 0.6 or even 0.7 in the next few months. Thanks, Tvrtko P.S. for the curious, my relations go like this: from elixir import Entity, Field, ... class Campaign(Entity): id = Field(Integer, Sequence('cc_campaign_seq'), colname='campaign_id', primary_key=True) qitems

[sqlalchemy] Re: Objects are wrongly getting removed/expunged from session

2011-01-15 Thread Tvrtko
On Jan 15, 5:57 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 15, 2011, at 11:53 AM, Tvrtko wrote: This is my first such case in 5-6 years of using the SA. Usually the problem was with my code. This could also be the case now, but it escapes me where I made a mistake

[sqlalchemy] Re: Objects are wrongly getting removed/expunged from session

2011-01-15 Thread Tvrtko
On Jan 15, 5:53 pm, Tvrtko qvx3...@gmail.com wrote: This is my first such case in 5-6 years of using the SA. Usually the problem was with my code. This could also be the case now, but it escapes me where I made a mistake. Thank you for your time. I will consider this closed for now and move

[sqlalchemy] Re: relation to arbitrary class (hibernate any)

2010-04-08 Thread Tvrtko
On Apr 7, 9:29 pm, Michael Bayer mike...@zzzcomputing.com wrote: Tvrtko wrote: I have a schema that cannot be changed. In it, there is a table with two columns:     element_type CHAR(1)     element_id INTEGER There is no foreign key on element_id because it can point to different

[sqlalchemy] relation to arbitrary class (hibernate any)

2010-04-07 Thread Tvrtko
in a flush process, or more generally behave like this is a normal relationship). I'm not sure if I explained it correctly, so I'll just mention that hibernate has any element that can do just that. Thanks, Tvrtko -- You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Re: relation to arbitrary class (hibernate any)

2010-04-07 Thread Tvrtko
And to make things event worse, I have to mantain a backref list/dict. On Apr 7, 8:30 pm, Tvrtko qvx3...@gmail.com wrote: I have a schema that cannot be changed. In it, there is a table with two columns:     element_type CHAR(1)     element_id INTEGER There is no foreign key on element_id

[sqlalchemy] Re: merge without merging related objects

2009-10-30 Thread Tvrtko
you want the cascade setting on history backref=backref(history, cascade='save-update') That did the trick! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] merge without merging related objects

2009-10-29 Thread Tvrtko
is merge-able. Any workaround will do. My version of sqlalchemy is 0.4.4 Thanks, Tvrtko --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: merge without merging related objects

2009-10-29 Thread Tvrtko
On Oct 29, 8:44 pm, Michael Bayer mike...@zzzcomputing.com wrote: Tvrtko wrote: Hi, is it possible to merge an object back to session, but without merging the entire tree of related objects. Just this one root object. the general way is to disable merge cascade on the relation(), using

[sqlalchemy] Re: merge without merging related objects

2009-10-29 Thread Tvrtko
On Oct 29, 9:33 pm, Michael Bayer mike...@zzzcomputing.com wrote: Tvrtko wrote: transient objects can be merged.  They get added to the session and enter the pending state. I get: InvalidRequestError: merge() with dont_load=True option does not support objects transient (i.e

[sqlalchemy] Re: merge without merging related objects

2009-10-29 Thread Tvrtko
Now on 0.4.8. And it is just not working. My copy method is flawed. Don't use it. The innards of sqlalchemy are just too complicated to mess around with. As for the cascade option. It also doesn't work. I have the following: mapper(History, history_table, properties = dict( user =