I can totally see a possibility that the tweaks I made in 1177 might cause
a problem.

However, this particular test confuses me (i.e., that it ever worked at all)

        # create a Two
        two = Two()
        two.id = 2

        # create a One
        one = One()
        one.id = 1

        # associate One with Two at the *id* level, but
        # dont actually connect the two objects together
        one.two_id = 2

        # save to the DB
        objectstore.commit()

        # call mapper.get(1) - as One is still in the identity map,
        # no SQL should really take place here...
        one = One.mapper.get(1)

        # Two is attached to One ?  whys that ?  Possibly
        # in pre 1177, the lazyloader attached to One would now fire off.
        # but i would consider *that* to be more buggy.... 'one' was just
        # created, in memory, why would it magically have a Two
        # attached to it now?  also note that if the one-two relation is
        # eager, youd get this same behavior pre-1177 since there is
        # similarly no lazy loader attached
        assert one.two is not None

        # unless, we explicitly say, get One back from the database:
        objectstore.refresh(one)  # or objectstore.expire(one)

        # ah now it works !
        assert one.two is not None

        # what does SQLALchemy usually expect ?
        # usually, that you deal with object references and not ID's
        one = One()
        one.two = Two()
        objectstore.commit()


hope this helps

Christopher Armstrong wrote:
> Hi all, I've noticed a regression in recent trunk versions of SQLAlchemy,
> regarding relations.
>
> I'm working with Gustavo Niemeyer, and I believe he contacted zzzeek about
> a
> similar issue. We ran into this problem in another case where there was
> some
> SQLAlchemy code that wasn't properly honoring the "passive" flag... Now,
> even though the fix that went in for this is still there in [EMAIL PROTECTED],
> some
> *other* code changes have regressed it back to its original condition.
> I've
> attached a minimal example showing the problem.
>
> -r 1176 runs the test fine. -r 1177, all the way up to HEAD, error out
> with
> the relation-ed attribute evaluating to None. So something in 1176:1177
> caused this regression. I was unable to figure out exactly what it was,
> but
> I hope this information should make it trivial to spot the problem.
>
> """
> r1177 | zzzeek | 2006-03-20 20:38:54 -0800 (Mon, 20 Mar 2006)
> a few changes to attributes.py to allow faster initialization of object
> attributes on new objects
> """
>
> Looks related ;-)
>
> Thanks!
>
> --
> Christopher Armstrong
> International Man of Twistery
> http://radix.twistedmatrix.com/
> http://twistedmatrix.com/
> http://canonical.com/
>



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to