can you please post a working test case for this.  I think im about ready
to make that an auto-reply.

I made one, and it works:

from sqlalchemy import *

e = create_engine('sqlite://', echo=True)
table1 = Table('mytable', e, Column('col1', Integer)).create()
table2 = Table('mytable2', e, Column('col2', Integer,
ForeignKey('mytable.col1'))).create()

join(table1, table2).select().execute().fetchall()

result:

[2006-03-24 19:31:58,241] [engine]:
CREATE TABLE mytable(
        col1 INTEGER
)


[2006-03-24 19:31:58,243] [engine]: None
[2006-03-24 19:31:58,248] [engine]:
CREATE TABLE mytable2(
        col2 INTEGER REFERENCES mytable(col1)
)


[2006-03-24 19:31:58,249] [engine]: None
[2006-03-24 19:31:58,254] [engine]: SELECT mytable.col1, mytable2.col2
FROM mytable JOIN mytable2 ON mytable.col1 = mytable2.col2
[2006-03-24 19:31:58,255] [engine]: []


Jose Galvez wrote:
> from the documentation shouldn't this work?
>
> join(table1, table2).select().execute().fetchall()
>
> When I jun that code I get the error None.table1 not defined
>
> however if I run
> join(table1, table2,
> table1.c.id==table2.c.fk).select().execute().fetchall()
>
> Then I get the expected results.
>
> shouldn't the above code work if I've defined the foreign key
> relationship correctly?
> jose
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to