[sqlalchemy] Re: trunk is now on 0.5

2008-05-12 Thread az
hi all my tests run ok on this (as well 0.4), except the concrete-inh case reported in http://groups.google.com/group/sqlalchemy/browse_thread/thread/92417a6f215fa8d8/c72eb562a3070bd9 - attached again. it's about concrete inh B of A, where polymunion contains only B, and there are instances of

[sqlalchemy] Re: trunk is now on 0.5

2008-05-12 Thread az
one thing that might go in a wishlist - query.filter_or() http://groups.google.com/group/sqlalchemy/browse_thread/thread/f6798eb5ef2c0bfe should i make it into a ticket? as you might have noticed we've merged 0.5 into the trunk. --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: trunk is now on 0.5

2008-05-12 Thread Michael Bayer
what does q.filter(x==5).filter_or(x==9).filter(y=17).filter_or(x==27) do ? (x=5 or x=9) and (y=17 or x=27) ? ((x=5 or x=9) and y=17) or x=27 ? etc .. On May 12, 2008, at 8:06 AM, [EMAIL PROTECTED] wrote: one thing that might go in a wishlist - query.filter_or()

[sqlalchemy] Reconnection to PostgreSQL

2008-05-12 Thread nymaol
Hi, I am using SQLALchemy 0.4.5 and PostgreSQL 8.1 db with psycopg2. If I restart the db I need to also restart my python server that is using the SQLAlchemy for interfacing the PostgreSQL db. Is there any means in the SQLAlchemy to automatically reconnect to the db without needing to restart the

[sqlalchemy] Re: Reconnection to PostgreSQL

2008-05-12 Thread Michael Bayer
On May 12, 2008, at 7:02 AM, nymaol wrote: Hi, I am using SQLALchemy 0.4.5 and PostgreSQL 8.1 db with psycopg2. If I restart the db I need to also restart my python server that is using the SQLAlchemy for interfacing the PostgreSQL db. Is there any means in the SQLAlchemy to automatically

[sqlalchemy] Re: trunk is now on 0.5

2008-05-12 Thread az
On Monday 12 May 2008 17:01:23 Michael Bayer wrote: what does q.filter(x==5).filter_or(x==9).filter(y=17).filter_or(x==27) do ? (x=5 or x=9) and (y=17 or x=27) ? ((x=5 or x=9) and y=17) or x=27 ? etc .. what pythons/C x==5 or x==9 and y==17 or x==27 does? i know... the parenthesises.

[sqlalchemy] 2 Many to many relations with extra-columns - How to for a newb

2008-05-12 Thread [EMAIL PROTECTED]
Hello All, I am trying to understand how to use SA and need some help. I have several tables with 2 many-to-many relations with extra columns and 1 only with foreign keys. See below for the definitions of tables and mappers. I also created classes for all tables (entities and associations). 1)

[sqlalchemy] Re: trunk is now on 0.5

2008-05-12 Thread Rick Morrison
-1. It's confusing, and there's already an extant or_ function that's documented and not confusing. The proposal is no more cooked than it was five months ago. On Mon, May 12, 2008 at 11:58 AM, [EMAIL PROTECTED] wrote: On Monday 12 May 2008 17:01:23 Michael Bayer wrote: what does

[sqlalchemy] Re: trunk is now on 0.5

2008-05-12 Thread Bobby Impollonia
I dont see how this: cls.query.left_bracket().filter_or(cls.y == 17).filter_or(cls.x==27).right_bracket() is clearer than this: cls.query.filter(or_(cls.y == 17, cls.x==27)) Also, another vote for cutting off python 2.3. Seriously, it's 2008. On Mon, May 12, 2008 at 11:58 AM, [EMAIL PROTECTED]

[sqlalchemy] Re: trunk is now on 0.5

2008-05-12 Thread Michael Bayer
On May 12, 2008, at 11:58 AM, [EMAIL PROTECTED] wrote: On Monday 12 May 2008 17:01:23 Michael Bayer wrote: what does q.filter(x==5).filter_or(x==9).filter(y=17).filter_or(x==27) do ? (x=5 or x=9) and (y=17 or x=27) ? ((x=5 or x=9) and y=17) or x=27 ? etc .. what pythons/C x==5 or x==9

[sqlalchemy] Re: trunk is now on 0.5

2008-05-12 Thread az
On Monday 12 May 2008 18:12:39 Bobby Impollonia wrote: I dont see how this: cls.query.left_bracket().filter_or(cls.y == 17).filter_or(cls.x==27).right_bracket() is clearer than this: cls.query.filter(or_(cls.y == 17, cls.x==27)) it's not. it's not about replacing the or_. noone should use it

[sqlalchemy] Re: trunk is now on 0.5

2008-05-12 Thread az
cls.query.left_bracket().filter_or(cls.y == 17).filter_or(cls.x==27).right_bracket() is clearer than this: cls.query.filter(or_(cls.y == 17, cls.x==27)) it's not. it's not about replacing the or_. noone should use it that way... u have horses and owners with houses and hats.

[sqlalchemy] sessionExtension

2008-05-12 Thread az
hi i have some pre_save automatic operations and decided MVC-like to split them into 2 phases - a per-object validation-only that goes at save(), and a per-flush set-up 2nd phase for putting timestamps etc. The 2nd one is via SessionExtension.before_flush(). i'm looking at the session state

[sqlalchemy] Re: trunk is now on 0.5

2008-05-12 Thread Michael Bayer
On May 12, 2008, at 1:48 PM, [EMAIL PROTECTED] wrote: cls.query.left_bracket().filter_or(cls.y == 17).filter_or(cls.x==27).right_bracket() is clearer than this: cls.query.filter(or_(cls.y == 17, cls.x==27)) it's not. it's not about replacing the or_. noone should use it that way... u

[sqlalchemy] Re: sessionExtension

2008-05-12 Thread Michael Bayer
On May 12, 2008, at 2:08 PM, [EMAIL PROTECTED] wrote: hi i have some pre_save automatic operations and decided MVC-like to split them into 2 phases - a per-object validation-only that goes at save(), and a per-flush set-up 2nd phase for putting timestamps etc. The 2nd one is via

[sqlalchemy] Re: sessionExtension

2008-05-12 Thread az
i have some pre_save automatic operations and decided MVC-like to split them into 2 phases - a per-object validation-only that goes at save(), and a per-flush set-up 2nd phase for putting timestamps etc. The 2nd one is via SessionExtension.before_flush(). i'm looking at the session

[sqlalchemy] Re: sessionExtension

2008-05-12 Thread Michael Bayer
On May 12, 2008, at 2:37 PM, [EMAIL PROTECTED] wrote: orphans i dont care, but the rest... So at what time these are available - after_flush? or before_commit? for foreign key attributes written by a dependency, before_insert(). i need to iterate over *all* would-be written-to-DB objects,

[sqlalchemy] Re: 2 Many to many relations with extra-columns - How to for a newb

2008-05-12 Thread Michael Bayer
lets all repeat the mantraassociation tables with any columns beyond the two foreign keys use the association object pattern. I guess its a little too wordy to be catchy. Documented at http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_relation_patterns_association .

[sqlalchemy] Re: sessionExtension

2008-05-12 Thread az
orphans i dont care, but the rest... So at what time these are available - after_flush? or before_commit? for foreign key attributes written by a dependency, before_insert(). it might be useful if there is a simple sequence diagram - textual is ok - for which kind of extension and

[sqlalchemy] Re: sessionExtension

2008-05-12 Thread Michael Bayer
On May 12, 2008, at 3:16 PM, [EMAIL PROTECTED] wrote: orphans i dont care, but the rest... So at what time these are available - after_flush? or before_commit? for foreign key attributes written by a dependency, before_insert(). it might be useful if there is a simple sequence diagram -

[sqlalchemy] Retrieving id (primary key) from newly inserted record when id generated by pre-insert trigger

2008-05-12 Thread Dr.T
I saw the posts about SQLAlchemy updating an id when this is generated by SQLAlchemy by setting Sequence() on the table's primary key Column, but being an old Oracle hacker, I am generating the primary keys via pre-insert triggers on the tables. As SQLAlchemy is not selecting seq_name.nextval

[sqlalchemy] composite primary key/postgres

2008-05-12 Thread az
hi. i have a sort-of multicolumn m2m association table, where the primary key is composed of all the links. At least 1 link (actualy, 2) is always present, but never all. so i am defining all of those columns with primary_key=True, nullable=True. which is fine in sqlite, but doesnot work in

[sqlalchemy] Re: Retrieving id (primary key) from newly inserted record when id generated by pre-insert trigger

2008-05-12 Thread Michael Bayer
On May 12, 2008, at 2:54 PM, Dr.T wrote: I saw the posts about SQLAlchemy updating an id when this is generated by SQLAlchemy by setting Sequence() on the table's primary key Column, but being an old Oracle hacker, I am generating the primary keys via pre-insert triggers on the tables.

[sqlalchemy] Re: 2 Many to many relations with extra-columns - How to for a newb

2008-05-12 Thread Michael Bayer
Hey - I wrote you a reasonable test application using your tables. So I apologize, you werent mapping secondary to an association table, I thought I saw that but it was an email formatting issue. You were creating overlapping names to relations though, so the attached script resolves