Hi.
Please consider this example:
from sqlalchemy import *
db = create_engine('postgres://manlio:[EMAIL PROTECTED]/test', echo=True)
metadata = BoundMetaData(db)
a = Table(
'a', metadata,
Column('x', Float),
Column('y', Float),
)
metadata.create_all()
try:
conn = db.connect()
i = a.insert()
conn.execute(i, x=6, y=5)
op = (a.c.x / a.c.y).label('z')
query = select([op], order_by=[op], use_labels=True)
result = conn.execute(query).fetchall()
for r in result:
print r
finally:
metadata.drop_all()
This generates an invalid query:
SELECT (a.x / a.y) AS z
FROM a ORDER BY (a.x / a.y) AS z
Is it possible to make SQLAlchemy smarter and just generate:
SELECT (a.x / a.y) AS z
FROM a ORDER BY z
?
P.S.
I do not understand why the drop_all call blocks the program. (I have to
send a QUIT signal).
Thanks Manlio Perillo
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---