[sqlalchemy] This join does not fill in the collection

2009-05-28 Thread Marcin Krol
Hello everyone, session.query(Reservation, Host).join(Reservation.hosts).filter(Reservation ...).all() Reservation.hosts is not filled in, when I access .hosts collection in individual Reservations, SQLA issues queries to fill in the collection one Reservation by one. Again, Reservation and

[sqlalchemy] Re: Questions on SQLA Queries

2009-05-28 Thread Timothy N. Tsvetkov
You right, i don't like chain, because i'm to lazy to import itertools %) so i use 'map'. On May 27, 5:13 pm, Gregg Lind gregg.l...@gmail.com wrote: I believe by map function, Timothy may be implying that you should use any of the python idioms for converting iterables of tuples to a straight

[sqlalchemy] Re: This join does not fill in the collection

2009-05-28 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Marcin Krol Sent: 28 May 2009 10:09 To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] This join does not fill in the collection Hello everyone,

[sqlalchemy] Re: This join does not fill in the collection

2009-05-28 Thread Marcin Krol
Hello Simon, This answered my question, thanks! (I don't know how I missed that in docs..) This is theoretically theoretical: But suppose I *did* some selection on Hosts and still used .options(eagerload('hosts')) on query - would that screw smth up? In particular, if I called

[sqlalchemy] Adding alias to columns

2009-05-28 Thread Ash
Hello, I want to add the alias for the columns is it possible in sqlalchemy. Say i have select id as uid from xyz so i do like this t1 = Table(xyz, metadata) id = Column(id) Now i want to add alias to it id = Column(id,alias_= uid) :( didnt work Can i add it later like i make default say

[sqlalchemy] Re: This join does not fill in the collection

2009-05-28 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Marcin Krol Sent: 28 May 2009 13:57 To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] Re: This join does not fill in the collection Hello Simon, This answered my

[sqlalchemy] Populate a mapped class from RowProxy

2009-05-28 Thread Andi Albrecht
Hi, maybe I've overlooked something very trivial, but how can I populate a mapped class from a RowProxy? Here's a simple example of what I'd like to do (using TurboGears): class Foo(object): pass database.mapper(Foo, database.metadata.tables[footable]) Now I have a rather complex SQL that

[sqlalchemy] Re: multiple tables for only one schema ...?

2009-05-28 Thread Michael Bayer
sbard wrote: hello, i've got a database with one table per country. for example : part_es (for spain) part_uk () part_it each tables have got the same schema (id, libel, description, part_numer) same __init__ method same __repr__ method is there an easy way to avoid

[sqlalchemy] Re: making join with using clause

2009-05-28 Thread Michael Bayer
SQLAlchemy SQL expressions have no need for JOIN USING which is just a typing saver in straight SQL. you can approximate this in Python as follows: def using(t1, t2, *names): return join(t1, t2, onclause=and_(*[t1.c[x]==t2.c[x] for x in names])) Ash wrote: Hello I want to make a

[sqlalchemy] Re: 0.5.4p2 Tests failed

2009-05-28 Thread Melton Low
Hi Michael, I just installed 0.5.4p2 on my Mac 10.5.7 Intel with the Python bundled pysqlite. Test suite ran without a single error. From your post to psqlite, there is a way for memory and gc to be managed. Hope they implement the change on the upcoming updates. Meanwhile, it's probably safe

[sqlalchemy] Re: making join with using clause

2009-05-28 Thread Ashish Bhatia
Thanks. I have one more question do we have the option of making different type of joins ? i have seen in docs it says it have join and outer join only What abbt left outer right outer natural cross and many ... On May 28, 9:00 pm, Michael Bayer mike...@zzzcomputing.com wrote: SQLAlchemy SQL