Re: [sqlalchemy] auto-flush getting order of inserts wrong when sessionmaker used

2011-02-27 Thread Chris Withers
On 27/02/2011 06:34, Michael Bayer wrote: More interestingly, why does the use of sessionmaker versus the use of the standard Session class make a difference? the unit of work issues INSERTS in order for a single kind of entity.It doesn't do that across all entities since the

[sqlalchemy] SQL Alchemy Help - Where Clauses

2011-02-27 Thread stoneferry
Hi I'm wondering if someone could help me with SQLAlchemy and WHERE clauses since I'm having trouble putting a query together. What I want in my WHERE clause is the below, noting the brackets: WHERE (game_participation.was_a_sub = %s AND game_participation.was_subbed = %s) OR

Re: [sqlalchemy] auto-flush getting order of inserts wrong when sessionmaker used

2011-02-27 Thread Michael Bayer
On Feb 27, 2011, at 3:28 AM, Chris Withers wrote: On 27/02/2011 06:34, Michael Bayer wrote: More interestingly, why does the use of sessionmaker versus the use of the standard Session class make a difference? the unit of work issues INSERTS in order for a single kind of entity.It

Re: [sqlalchemy] auto-flush getting order of inserts wrong when sessionmaker used

2011-02-27 Thread Michael Bayer
On Feb 27, 2011, at 10:28 AM, Michael Bayer wrote: On Feb 27, 2011, at 3:28 AM, Chris Withers wrote: On 27/02/2011 06:34, Michael Bayer wrote: More interestingly, why does the use of sessionmaker versus the use of the standard Session class make a difference? the unit of work

Re: [sqlalchemy] SQL Alchemy Help - Where Clauses

2011-02-27 Thread Michael Bayer
On Feb 27, 2011, at 8:12 AM, stoneferry wrote: Hi I'm wondering if someone could help me with SQLAlchemy and WHERE clauses since I'm having trouble putting a query together. What I want in my WHERE clause is the below, noting the brackets: WHERE (game_participation.was_a_sub = %s AND

[sqlalchemy] iterate_to_root

2011-02-27 Thread Chris Withers
Hi All, I'm reading http://www.sqlalchemy.org/trac/browser/examples/versioning/history_meta.py?rev=7253:3ef75b251d06 and I'm curious about the following in line 112-114: - what does iterate_to_root do? - why do we need to iterate over the object mappers and the history mappers? - what does

Re: [sqlalchemy] iterate_to_root

2011-02-27 Thread Michael Bayer
On Feb 27, 2011, at 1:23 PM, Chris Withers wrote: Hi All, I'm reading http://www.sqlalchemy.org/trac/browser/examples/versioning/history_meta.py?rev=7253:3ef75b251d06 and I'm curious about the following in line 112-114: - what does iterate_to_root do? return the hierarchy of mappers

[sqlalchemy] SessionExtension and cascading

2011-02-27 Thread Chris Withers
Hi All, In the before_flush of a SessionExtension, is there any way I can tell if an object is in session.deleted as a result of being deleted in its own right or as a result of being cascaded from the delete of another object? cheers, Chris -- Simplistix - Content Management, Batch

[sqlalchemy] mortar_rdb 1.1.0 released!

2011-02-27 Thread Chris Withers
Hi All, I'm pleased to announce a new release of mortar_rdb. This package ties together SQLAlchemy, sqlalchemy-migrate and the component architecture to make it easy to develop projects using SQLAlchemy through their complete lifecycle. This release allows you to register SessionExtensions

Re: [sqlalchemy] SessionExtension and cascading

2011-02-27 Thread Michael Bayer
hmm ! not really actually. Also, some deletes, such as for de-associated orphans, don't get added to delete until after before_flush(). On Feb 27, 2011, at 4:00 PM, Chris Withers wrote: Hi All, In the before_flush of a SessionExtension, is there any way I can tell if an object is in

Re: [sqlalchemy] Find whether a synonym points to a foreign key or a relationship (Looking for your blessing)

2011-02-27 Thread Hector Blanco
A few days ago I asked what appears in the body of the message, a few lines below. To summarize: Let's say I have a class User (yeah, to define users in my application) and each user can belong to one UserGroup (another class of my application). The User class would be something like: class

Re: [sqlalchemy] Find whether a synonym points to a foreign key or a relationship (Looking for your blessing)

2011-02-27 Thread Michael Bayer
On Feb 27, 2011, at 6:45 PM, Hector Blanco wrote: A few days ago I asked what appears in the body of the message, a few lines below. To summarize: Let's say I have a class User (yeah, to define users in my application) and each user can belong to one UserGroup (another class of my

Re: [sqlalchemy] SessionExtension and cascading

2011-02-27 Thread Chris Withers
On 27/02/2011 23:20, Michael Bayer wrote: hmm ! not really actually. No probs, I thought that'd be a bit of a stretch ;-) Also, some deletes, such as for de-associated orphans, don't get added to delete until after before_flush(). Hmm, does this imply that the versioning recipes that

Re: [sqlalchemy] SessionExtension and cascading

2011-02-27 Thread Michael Bayer
On Feb 28, 2011, at 1:26 AM, Chris Withers wrote: On 27/02/2011 23:20, Michael Bayer wrote: hmm ! not really actually. No probs, I thought that'd be a bit of a stretch ;-) Also, some deletes, such as for de-associated orphans, don't get added to delete until after before_flush().