Dnia 2009-07-29, Śr o godzinie 11:24 -0400, Michael Bayer pisze:
> Tefnet Developers wrote:
> >
> > [10:00] < jezier> stepz_: in for m in mapper.polymorphic_iterator(): you
> > get random order i think
> 
> While I haven't tested this, based on inspection it should only be random
> within one level of hierarchy, which shouldn't cause this issue.
> 
> 
> e.g.
> 
> 
> D <-  B  <-  A
> E <-  C  <-  A
>       F  <-  A
> 
> would yield
> 
> (A), (B, C, F), (D, E)
> 
> 
I've looked a little bit deeper into it and found that:

----
GOING INSIDE LOOP Mapper|B|B (_register_attribute strategies.py:49)
class:<class '__main__.B'> | key:attr

GOING INSIDE LOOP Mapper|B|B (_register_attribute strategies.py:49)
class:<class '__main__.B'> | key:Id

GOING INSIDE LOOP Mapper|A|A (_register_attribute strategies.py:49)
class:<class '__main__.A'> | key:attr
class:<class '__main__.B'> | key:attr

GOING INSIDE LOOP Mapper|A|A (_register_attribute strategies.py:49)
class:<class '__main__.A'> | key:Id
class:<class '__main__.B'> | key:Id

GOING INSIDE LOOP Mapper|A|A (_register_attribute strategies.py:49)
class:<class '__main__.A'> | key:objectType
class:<class '__main__.B'> | key:objectType
----

this is the order of _register_attribute when I have
----
class A(Base):
        Id
        attr
        objectType

class B(A):
        attr
----

as you can see it is in reverse order, first it sets B attrs and then A
(parent) attrs

The order of classes is from sqlalchemy/orm/mapper.py line 652:
---
for mapper in list(_mapper_registry):
---
shouldn't _mapper_registry be an ordered dict or something?





Tomasz Jezierski
Tefnet


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