So here's a simplified version of the models I 
have: http://pastie.org/private/smqzkvz4zj46skfmipruw
Python==3.3
SQLAlchemy==0.9.1
psycopg2==2.5.2
Postgresql 9.2

Running the following query,
session.query(Training).filter(Training.start_date > '2013-11-01')

Gives me the following SQL:
SELECT trainings.id AS trainings_id, trainings.title AS trainings_title, 
view_training_start_dates_1.start AS view_training_start_dates_1_start
FROM view_training_start_dates, trainings LEFT OUTER JOIN 
view_training_start_dates AS view_training_start_dates_1 ON trainings.id = 
view_training_start_dates_1.training_id
WHERE view_training_start_dates.start > '2013-11-01'

There are two problems. In the FROM clause, view_training_start_dates 
should not be there, and in the WHERE clause, 
`view_training_start_dates.start` should be 
`view_training_start_dates_1.start`.

Is what I'm trying possible with hybrid properties? Or should I be looking 
to alter the query instead?

Note: I tried doing a simple select expression for start_date, but it 
wasn't performing as well as I'd like.

Any help is much appreciated! Thanks!

-Matt

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to