Re: slooow delete

John Lenton <[email protected]> Thu, 10 Mar 2005 13:20:41 -0300
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
On 10 Mar 2005 15:10:59 +0100, Sebastien Bigaret
<[email protected]> wrote:
> 
> I'd like to understand why so many objects are fetched (is there, by any
> chance, a to-many relationships without an inverse relationship defined
> pointing back to the object?)

I'm pretty certain there isn't; this is the entity I'm deleting (sans
the non-relationship properties):

    Entity ('Task',
            properties= [
                RToOne ('need', 'Need', joinSemantic=2, inverse='tasks'),
                RToOne ('team', 'Team', joinSemantic=2, inverse='tasks'),
                RToOne ('mealType', 'MealType', joinSemantic=2,
inverse='tasks'),
            ],
    ),

the weird thing is that the entities it loads are all Tasks, the same
thing (a whole load of Tasks getting loaded) happens upon insert; what
triggers it in that case is

    team.addToTasks(task)

whereas on the previous line I have a

    need.addToTasks(task)

and that doesn't trigger it.

Here are the Relationships defined in both Need and Team:

    Entity ('Team',
            properties= [
                RToOne ('offer', 'Offer', joinSemantic=2, inverse='teams'),
                RToMany ('tasks', 'Task', inverse='team'),
                RToMany ('userTeams', 'UserTeam', inverse='team'),
            ],
    ),
    Entity ('Need',
            properties= [
                RToOne ('category', 'Category', joinSemantic=2,
inverse='needs'),
                RToOne ('sponsor', 'User', joinSemantic=2, inverse='needers'),
                RToOne ('offer', 'Offer', joinSemantic=2, inverse='needs'),
                RToOne ('user', 'User', joinSemantic=2, inverse='needs'),
                RToOne ('visibility', 'Visibility', joinSemantic=2,
inverse='needs'),
                RToMany ('tasks', 'Task', inverse='need'),
            ],
    ),


-- 
John Lenton ([email protected]) -- Random fortune:
Don't anthropomorphise computers and cars, They hate that.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click