So in simple words, how do I speed this up?

On 16 Paź, 18:42, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Oct 16, 2008, at 12:31 PM, g00fy wrote:
>
>
>
>
>
> > I have loads of related fields in my model.
> > I set up lazy = False where i had to and i don't know why SA keeps
> > "duplicating" (aliasing) my tables, so i fetch my data twice (2 times
> > more column that i realy need)
>
> > i send my model and mappings and the sql code SA is querying.
>
> > models:
> >http://dpaste.com/84873/
> > tables:
> >http://dpaste.com/84874/
> > mappings:
> >http://dpaste.com/84875/
> > sql:
> >http://dpaste.com/84876/
>
> > notice in sql that  anon_1 is realy the same as w_warehouse.
> > this way i am stuck with 1000 objects having 2 languages and 2
> > currencies.
>
> > the code I do is :
> > meta
> > .Session
> > .query(model.Warehouse).order_by(model.Warehouse.area_total.asc())
> > [0:10]
> > .filter(
> >                    model.Warehouse.price.has(
> >                        model.Price.total<=price_total_max
> >                    )
> >                )
>
> > how can I get rid of that nasty anon_1, and speed up this thing?
>
> look 
> intohttp://www.sqlalchemy.org/trac/wiki/FAQ#ImusinglazyFalsetocreateaJOIN...
>    .   an eager load of "Price" is not related to the filter criterion  
> using "Price" - you need to join explicitly.
>
> To "dual purpose" your explicit join as an eager load as well, look  
> into :  
> http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_relatio...
>
>
>
>
--~--~---------~--~----~------------~-------~--~----~
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