[sqlalchemy] Re: Inheritance problem: how to configure a relation with a child, but without the parent?

2009-05-18 Thread fleong
the foreign key between table2 and their children was wrong.. now works correctly. Thanks for your help! greetings, Fernando table_21 = \ Table( 'table_21', metadata, Column('id2', Integer, primary_key = True), Column('info', String), ForeignKeyConstraint(['id2'],['table_2.id2'

[sqlalchemy] Re: Inheritance problem: how to configure a relation with a child, but without the parent?

2009-05-18 Thread Michael Bayer
try taking a look at your SQL output. the issue is pretty obvious, the join condition between your two tables is insufficient to get a T22 row. table_2.id has two rows with "0" for the "id" column, so joining from table_2 to table_22 on just "id" gives you two rows. it has nothing to do

[sqlalchemy] Re: Inheritance problem: how to configure a relation with a child, but without the parent?

2009-05-18 Thread fleong
0 in a numerical primary key.. excuse if it is obvious, but: what's wrong? :/ I've tried and nothing.. when ask for instances that are linked through 't22' get all instances of 'Table2'. There must be something in the relationships configuration involving the entire table.. can it be? On 18 may

[sqlalchemy] Re: Inheritance problem: how to configure a relation with a child, but without the parent?

2009-05-18 Thread Michael Bayer
have you tried not using "0" for a primary key ? i feel like that might be getting in the way. On May 18, 2009, at 3:59 PM, fleong wrote: > > Sorry for the delay. Yes, i want to reference Table22, the 'correct' > code is as follows, but obtains the same result. Don't understand > because not

[sqlalchemy] Re: Inheritance problem: how to configure a relation with a child, but without the parent?

2009-05-18 Thread fleong
Sorry for the delay. Yes, i want to reference Table22, the 'correct' code is as follows, but obtains the same result. Don't understand because not run when it corrects.. Is it not possible to link TableExt22 with Table22 only? Thanks for the quick answer! Fernando #--

[sqlalchemy] Re: Inheritance problem: how to configure a relation with a child, but without the parent?

2009-05-18 Thread Michael Bayer
On May 18, 2009, at 8:51 AM, fleong wrote: > t = Table1() > t.id = 0 > > tex = TableEx22() > tex.id = 0 > > s.add(t) > s.add(tex) > s.commit() > > t21 = Table21() > t21.id2 = 0 > t21.t1 = t > s.add(t21) > s.commit() > > t22 = Table22() > t22.id2 = 1 > t22.t1 = t > t22.tex = tex > s.add(t22) > s.

[sqlalchemy] Re: inheritance problem

2009-04-15 Thread Julien Cigar
On Tue, 2009-04-14 at 20:58 -0400, Michael Bayer wrote: > if joined table inheritance can't figure out the join condition between > the two tables, use the "inherit_condition" argument to mapper() which > works similarly to primaryjoin on relation(). > it works with inherit_condition, thanks !

[sqlalchemy] Re: inheritance problem

2009-04-14 Thread Michael Bayer
if joined table inheritance can't figure out the join condition between the two tables, use the "inherit_condition" argument to mapper() which works similarly to primaryjoin on relation(). Julien Cigar wrote: > > Hello, > > I'm playing with inheritance for a project. The idea is that I have a >