On Jun 23, 9:11 am, Carles <carle...@gmail.com> wrote: > Sorry but, any thoughts?
Have you looked at http://www.web2py.com/book/default/section/6/6?search=puppy or http://www.web2py.com/book/default/section/6/9?search=puppy (you could have a relationship field if you _needed_, or you could simply have a parent / child table, with id of the parent in a parent field, id of a child in child field).. I'm not sure I know what you want / why you want this, why an attribute on a field is "special" for your request.... - Yarko > > Carles > > El 22/06/2010, a las 19:56, Carles Gonzalez <carle...@gmail.com> escribió: > > > > > My english is horrible, an maybe it wasn't clear, but that was exactly > > my problem :). > > > Currently i'm looking at the code massimo told me about but i think > > that the problem isn't here. > > > I explain: the parent is assigned when the child entity is created (at > > the constructor level), to ensure all entities on the same group are > > stored together (or close), that way transactions are feasible. > > > I don't think i'm capable of doing that right now, but my proposed > > soultion (just an idea) is to extend the field definition syntax for > > reference fields, adding an atribute to indicate this tipe of > > relationship. > > > Example (blatantly stolen from the book): > > > db.define_table('person', > > Field('name')) > > db.define_table('dog', > > Field('name'), > > Field('owner', db.person, relationship="parent")) > > > On SQL databases that attribute would be ignored, but in GAE web2py > > would enforce the parent relationship at creation and dog[id].parent > > would return the result of dog_instance.parent() > > > I don't know if this is feasible or if i'm total crazy (an option to > > consider). Opinions? > > > On Tue, Jun 22, 2010 at 1:42 AM, Matt <mjwat...@gmail.com> wrote: > >> Any chance this could be considered as well? > > >> Currently the DAL doesn't allow you to set the parent which is > >> required for GAE entity groups. > > >>http://groups.google.com/group/web2py/browse_thread/thread/3c11deb2bf... > > >> On Jun 22, 7:35 am, Carles <carle...@gmail.com> wrote: > >>> Ok, I'll try. > > >>> Carles > > >>> El 21/06/2010, a las 19:03, mdipierro <mdipie...@cs.depaul.edu> escribió: > > >>>> The only file you need to look into is gluon/contrib/gql.py > > >>>> specifically the select() function which calls filter returns the Rows > >>>> object > > >>>> On Jun 21, 11:55 am, Carles Gonzalez <carle...@gmail.com> wrote: > >>>>> Ok, thanks! I would like to make the patch myself, but the innards of > >>>>> web2py are somewhat complex... > > >>>>> Thanks again, Carles. > > >>>>> On Mon, Jun 21, 2010 at 6:43 PM, mdipierro <mdipie...@cs.depaul.edu> > >>>>> wrote: > >>>>>> Probably it would not be hard to implement. I will look into this next > >>>>>> week but if somebody sends me a patch before that I will take it. > > >>>>>> Massimo > > >>>>>> On Jun 21, 9:25 am, Carles Gonzalez <carle...@gmail.com> wrote: > >>>>>>> Hi, > > >>>>>>> I have developed some applications in web2py, and 2 are running > >>>>>>> currently in gae, but now i have serious problem. > > >>>>>>> My current project is a social application, and when i design > >>>>>>> (example) the tables to make an user follow the actions other user > >>>>>>> (twitter like) I find that many-to-many relationships in app-engine > >>>>>>> are not easily supported. > > >>>>>>> From my understanding using the tools present in web2py right i would > >>>>>>> need to do a lot of processing in memory, an that would hurt > >>>>>>> performance greatly. > > >>>>>>> The pattern proposed by app store developers uses lists and "parent" > >>>>>>> relationship: > > >>>>>>> class Message(db.Model): > >>>>>>> sender = db.StringProperty() > >>>>>>> body = db.TextProperty() > > >>>>>>> class MessageIndex(db.Model): > >>>>>>> receivers = db.StringListProperty() > > >>>>>>> indexes = MessageIndex.all(keys_only = True).filter('receivers = ', > >>>>>>> user_id) > >>>>>>> keys = [k.parent() for k in indexes) > >>>>>>> messages = db.get(keys) > > >>>>>>> For using that pattern in web2py I would need a method for specifying > >>>>>>> the parent of a model instance. Can I specify that relationship using > >>>>>>> any method I don't know? If not, would it be hard to implement? > > >>>>>>> Thanks in advance!