On Dec 9, 2007, at 2:31 PM, Artur Siekielski wrote:

>
>> no, from_statement replaces all filtering.
>
> Shouldn't it throw some exception then?

funny you should say that, this week we've been adding warnings for  
query methods that are called when they would ignore some part of the  
existing criterion, so will add this.

> cannot tell users - here you have a Query object, but filtering
> sometimes doesn't work! So it seems that if I want to have object-
> oriented proxy for SQL results with lazy loading, I must write my own
> wrapper.

we've had requests for this before, and since we've recently greatly  
improved our ability to alias clauses against a new selectable, im  
going to try to commit this.  select_from()'s behavior is going to  
change here but I dont think the replaced behavior is anything anyone  
was using (i.e. it currently builds a list of clauses,but you dont  
really need that for anything).

note that we haven't had this feature before since its quite  
complicated; if I say  
query.select_from(users.select(users.c.id.in_([7,  
8])).alias()).filter(User.id==7), the generated query must be:

SELECT anon_1.id AS anon_1_id, anon_1.name AS anon_1_name
FROM (SELECT users.id AS id, users.name AS name  FROM users WHERE  
users.id IN (%(users_id_1)s, %(users_id_2)s)) AS anon_1
WHERE anon_1.id = %(users_id_3)s ORDER BY anon_1.id

i.e. the incoming filter() criterion has to be aliased, the actual  
columns which the mapper receives are now named differently so are  
also translated on a row-by-row basis, etc.
currently i have it working for non-eager queries.  when the feature  
is complete there still may be more complex queries that just dont  
come out correctly, we'll have to see.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to