[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread Darren Govoni
#x27;x', 'y', 'z'): > setattr(newobj, attr, deepcopy(getattr(self, attr))) > > return newobj > > > If you really want to copy lots of data between two databases though, > its probably a lot more efficient to not use an ORM for th

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread Darren Govoni
y case u'll have to do the hierarchy-copying yourself - even if > moving one object (alone) from session to session succeeds somehow. > > On Saturday 17 January 2009 14:47:41 Darren Govoni wrote: > > After some further experimenting with this, it seems I cannot take > >

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread Darren Govoni
l have to do the hierarchy-copying yourself - even if > moving one object (alone) from session to session succeeds somehow. > > On Saturday 17 January 2009 14:47:41 Darren Govoni wrote: > > After some further experimenting with this, it seems I cannot take > > a mapped object I r

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread Darren Govoni
, especially for replication at the object layer. So is it true that this cannot currently be done with sqlalchemy? I have been reading the docs, but no clues yet. On Fri, 2009-01-16 at 16:53 -0500, Darren Govoni wrote: > Hi, > I have an object (with references) I get from a session on data

[sqlalchemy] Migrating objects across sessions

2009-01-16 Thread Darren Govoni
Hi, I have an object (with references) I get from a session on database A and I want to copy it (deep copy) to database B. I tried expunging it from the first session and adding it to the second. What's the best practice to do this? thanks! Darren --~--~-~--~~~---~-

[sqlalchemy] Re: Self-Referential Mapping with Base?

2009-01-11 Thread Darren Govoni
Ahhh, looks like I'm on rc4. Let me try final and see. On Sun, 2009-01-11 at 13:10 -0500, Michael Bayer wrote: > 0.5.0 final ? > > On Jan 11, 2009, at 12:21 PM, Darren Govoni wrote: > > > > > Hi MikeCo, > > I tried your example, and got this error from SA

[sqlalchemy] Re: Self-Referential Mapping with Base?

2009-01-11 Thread Darren Govoni
Hi MikeCo, I tried your example, and got this error from SA 0.5. ValueError: need more than 0 values to unpack Darren On Fri, 2009-01-09 at 20:33 -0800, MikeCo wrote: > from sqlalchemy import * > from sqlalchemy.orm import * > from sqlalchemy.ext.declarative import declarative_base > > dbnam

[sqlalchemy] Re: Does limit() work with update()?

2009-01-11 Thread Darren Govoni
-0500, Michael Bayer wrote: > > On Jan 11, 2009, at 11:40 AM, Darren Govoni wrote: > > > > > Sorry for the haze. I'm using PostgreSQL and am checking their docs on > > isolation to see that it is consistent with SA. > > > > but here is a simplified exam

[sqlalchemy] Re: Does limit() work with update()?

2009-01-11 Thread Darren Govoni
ults. A, B exit. Re-run B. B finds 1 row where FOO=NULL and sets FOO=B. B exits. Does that help clarify? thank you. On Sun, 2009-01-11 at 11:33 -0500, Michael Bayer wrote: > > On Jan 11, 2009, at 11:18 AM, Darren Govoni wrote: > > > > > Thank you, > > > > S

[sqlalchemy] Re: Does limit() work with update()?

2009-01-11 Thread Darren Govoni
Thank you, So I changed my query to a select/for update. then re-added the updated rows in the transaction, then committed. works=session.query(Work).filter(tnow-Work.taken > On Jan 11, 2009, at 10:44 AM, Darren Govoni wrote: > > > > > Hi, > > I have 2 records in

[sqlalchemy] Does limit() work with update()?

2009-01-11 Thread Darren Govoni
Hi, I have 2 records in the database. I made an expression to update only 1 record, but all are getting updated. works=session.query(Work).filter(tnow-Work.takenhttp://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---

[sqlalchemy] Re: Self-Referential Mapping with Base?

2009-01-10 Thread Darren Govoni
#x27;child'): > > for ch in obj.child: > > printobj(ch, indent=indent+'') > > > > def listd(): > > # retrieve and list > > sess = Session() > > print '# D->D' > > query = sess.query(D).filt

[sqlalchemy] Re: Self-Referential Mapping with Base?

2009-01-09 Thread Darren Govoni
Hi, Thanks for the response. I'm still fairly new to SA but am very impressed with this package! I tried a variety of combinations of mappings. If I use just the parent_id,parent it would seem to make sense logically if my children only have one parent. The tables generate fine. But when I try