[sqlalchemy] Create tables with hierarchy relationship

2008-05-29 Thread PopCorn
Hi all, Currently i am having problem with this implementation. I have 4 tables, namely 1 parent table with 3 children tables. Primary key from the parent table is assigned to each of the children table. However, if primary key 1 is being assigned child table 1, it cannot be re-assignment to

[sqlalchemy] Re: Create tables with hierarchy relationship

2008-05-29 Thread az
not sure if u are talking about inheritance patterns? http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_mapper_inheritance Currently i am having problem with this implementation. I have 4 tables, namely 1 parent table with 3 children tables. Primary key from the parent table is

[sqlalchemy] How to generate not in behavior with subquery

2008-05-29 Thread bwb
I am using SQLAlchemy and I want to end up with a query like select state_voter_id, last_name, first_name from voter where state_voter_id in (select state_voter_id from vote where vote_date = '2000-02-23' and party_voted = 'D') and state_voter_id not in (select

[sqlalchemy] Re: How to generate not in behavior with subquery

2008-05-29 Thread Michael Bayer
On May 29, 2008, at 8:36 AM, bwb wrote: Any suggestions? try ~col.in_(value) or not_(col.in_(value)) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Re: Column name override with a relation requiring a primaryjoin

2008-05-29 Thread Michael Bayer
On May 29, 2008, at 11:58 AM, Brad Wells wrote: Thank you very much for your help. The post_update=True addition is what I was missing. The test case I was using was c1.created_by = c1 where created_by was previously null. (c1 having previously been saved and flushed) This seems to be

[sqlalchemy] Interval and mx.TimeDelta

2008-05-29 Thread Eoghan Murray
Hi, I'm trying to use mx.TimeDelta instead of datetime.timedelta on an Interval column (with Postgres). It seems to work fine until I get to intervals a day, at which point it fails with: ProgrammingError: (ProgrammingError) invalid input syntax for type interval: 1:00:00:00.00 'INSERT INTO

[sqlalchemy] Re: SQL Question - Find missing records with Outer Join

2008-05-29 Thread EricHolmberg
some_alg = sess.query(Alg).get(8) sess.query(Email).filter(~Email.threads.any(Thread.alg==some_alg)) The clause Thread.alg=some alg *should* just generate the clause thread.algid=8...it shouldn't pull in the alg table at all since its not needed for many-to-one comparison. That works

[sqlalchemy] Re: Interval and mx.TimeDelta

2008-05-29 Thread Michael Bayer
my understanding is that mx is no longer supported with psycopg2. You might want to ask on their list; SA just passes through objects for PG's date/time types. On May 29, 2008, at 2:27 PM, Eoghan Murray wrote: Hi, I'm trying to use mx.TimeDelta instead of datetime.timedelta on an