On Apr 3, 2008, at 1:43 PM, jason kirtland wrote:

>
> Yannick Gingras wrote:
>>
>> Hi, I use Alchemy to connection to a legacy system from which I pull
>> data to be inserter into a new system that is being built with  
>> Python.
>>
>> I'm only interested by a tiny fraction of the legacy data and I'm
>> wondering if it's possible to specify constraints to the mapper do
>> that
>>
>>  Obj.query()
>>
>> would only fetch rows with col_a == foo and col_b == bar.
>>
>> I know how to do that for a field of the object with
>>
>>  relation(..., primary_join=...)
>>
>> How would I do that at the object level?
>
> A couple approaches come to mind:
> - map Obj to a select() with the restrictions baked in
> - use Query(obj).select_from() with a restrictive select
>
> Making a custom Obj.query property that puts select_from on the  
> query by
> default is pretty easy too.

you can also set up the Mapper in the first place to use a subset of  
columns using the "include_properties" and "exclude_properties"  
arguments.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
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