[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2009-01-17 Thread az
u can look at my posts on the topic and all related too (-:) search for recursive/recursion/graph/sets in short: - storage: - store graph in pure form (nodes/edges only) - easy to maintain/update, very difficult to query - store some preprocessed (cached) denormalized form (all paths

[sqlalchemy] session.merge()

2009-01-17 Thread n00b
greetings, i'm batch processing xml documents to mysql using SA 0.5, ORM. data extracted from xml docs may be new or an update in form of a replacement of the existing object (record). (one of the columns, product_id, is unique=True). Hence, SA throws, as expected, an IntegrityError (1062,

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread Darren Govoni
After some further experimenting with this, it seems I cannot take a mapped object I retrieved from one session and save it in another. Using expunge then adding the object to a second session on a different database does not work. I thought maybe it would. This is a really useful thing to do,

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread az
read various threads about copy/deep-copy. in any 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

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread Darren Govoni
Yes, i'd like to do that, but because of the code injection seems to carry state from the old session, the new session has trouble with even the copy. On Sat, 2009-01-17 at 15:23 +0200, a...@svilendobrev.com wrote: read various threads about copy/deep-copy. in any case u'll have to do the

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread Darren Govoni
I tried using session.merge(deepcopy) on my copy.deepcopy of a mapped object(s) and when I commit the session I get RuntimeError: maximum recursion depth exceeded strange. On Sat, 2009-01-17 at 15:23 +0200, a...@svilendobrev.com wrote: read various threads about copy/deep-copy. in any case

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread az
Yes, i'd like to do that, but because of the code injection seems to carry state from the old session, the new session has trouble with even the copy. then, separate the issues: a) make a working deep copy within same session (this is not at all trivial, except for very simple schemas) b)

[sqlalchemy] Re: session.merge()

2009-01-17 Thread Laurent Rahuel
Hi, Did you first load the entry to update into the session or do you always create new objects to be saved ? I guess you need to: 1 - try to get the record from the database using the product_id or another unique field 2 - if the result set is not empty, update the record using

[sqlalchemy] Re: session.merge()

2009-01-17 Thread Michael Bayer
On Jan 17, 2009, at 4:07 AM, n00b wrote: greetings, i'm batch processing xml documents to mysql using SA 0.5, ORM. data extracted from xml docs may be new or an update in form of a replacement of the existing object (record). (one of the columns, product_id, is unique=True). Hence, SA

[sqlalchemy] Re: session.merge()

2009-01-17 Thread n00b
thanks. i'll give it a shot. On Jan 17, 10:43 am, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 17, 2009, at 4:07 AM, n00b wrote: greetings, i'm batch processing xml documents to mysql using SA 0.5, ORM. data extracted from xml docs may be new or an update in form of a

[sqlalchemy] Re: session.merge()

2009-01-17 Thread n00b
actually, this is exactly what i didn't want to do .. at least not explicitly. thx. On Jan 17, 3:24 am, Laurent Rahuel laurent.rah...@gmail.com wrote: Hi, Did you first load the entry to update into the session or do you   always create new objects to be saved ? I guess you need to: 1 -

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread Michael Bayer
On Jan 17, 2009, at 1:46 PM, Darren Govoni wrote: Hi, Thanks for the suggestions. In my system, it is a federation of databases using SQLA as the object layer. There are message queues that move detched data around as needed. My goal is to keep the application as OO as possible with

[sqlalchemy] SQLAlchemy 0.5.1 Released

2009-01-17 Thread Michael Bayer
This release includes a bunch of architectural enhancements that didn't make it into 0.5.0, a handful of bug fixes, and one bigger bug fix for a potential memory leak in Query. Upgrading is not mandatory but is recommended. Changes of note include: - the memory leak bug is

[sqlalchemy] Conflict between SQLAlchemy = 0.4.4 and coverage.py?

2009-01-17 Thread James
I'm using SA underneath a TurboGears 1.0 app. Upgrading SA from 0.4.3 to 0.4.4 causes previously passing unit tests to fail when run in conjunction with nose's coverage plugin -- I've included an example stack trace below. The unit tests run just fine when not using nose's --with-coverage

[sqlalchemy] Re: Conflict between SQLAlchemy = 0.4.4 and coverage.py?

2009-01-17 Thread Michael Bayer
this is a known Python issue fixed in 2.6. See http://www.sqlalchemy.org/trac/ticket/1138 for details. On Jan 17, 2009, at 9:23 PM, James wrote: I'm using SA underneath a TurboGears 1.0 app. Upgrading SA from 0.4.3 to 0.4.4 causes previously passing unit tests to fail when run in