The following example uses an elixir class:

class MyE(Entity):
    id = Field(Integer, primary_key=True)
    f_1 = ManyToOne('OtherE')
    f_2 = ManyToOne('OtherE')
    date = Field(Date)

MyE.query.select_from(union(MyE.table.select(),
                           select([MyE.id, MyE.f_1.label('f_2'),
MyE.f_2.label('f_1')]))).\
    order_by([MyE.date])

This produces the following SQL:

SELECT anon_1.id AS anon_1_id, anon_1.f_1 AS anon_1_f_1, anon_1.date
AS anon_1_date
FROM (
SELECT mye.id AS id, mye.f_1 AS f_1, mye.f_2 AS f_2, mye.date AS date
FROM mye UNION ALL
SELECT mye.id AS id, mye.f_2 AS f_1, mye.f_1 AS f_2, mye.date AS date
FROM mye) AS anon_1 ORDER BY anon_1.date

Which strangely omits the anon_1_f_2 column and so doesn't populate
the mapper correctly (f_2 is populated with the contents of f_1)
Is this a bug?
I've upgraded SQLAlchemy to 0.5.0rc4 and also elixir to 0.6.1 but it
still appears.

Thanks

Eoghan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to