26 Jun 09:12
Re: metakit relational questions
From: Riccardo Cohen <rcohen <at> articque.com>
Subject: Re: metakit relational questions
Newsgroups: gmane.comp.db.metakit
Date: 2007-06-26 07:12:29 GMT
Subject: Re: metakit relational questions
Newsgroups: gmane.comp.db.metakit
Date: 2007-06-26 07:12:29 GMT
in the page http://support.articque.com/metakit/metakit_tutorial.html you will find a small example of relation davidm wrote: > Hi, > > I worked out how to do nested views (from trawling through list > archives, it isn't mentioned in the python documentation) - this is > great for emulating a simple SQL join. > > But how do you do two tables that relate to each other? > > For example, imagine one table called 'Director' which has the > columns: > - name (string) > - age (int) > - companies (related join to Company) > > and another table called 'Company', which has the columns: > - name (string) > - directors (related join to Person) > > The situation is that each person, represented by a row in Director, > could be a director of more than one company, and each company would > often have two or more directors. > > I'm familiar with SQLObject, where this can be very easily > accomplished with 'RelatedJoin' column types. > > But is there a way to do this in Metakit? For example, given a person, > look up the list of companies of which s/he is a director, and for a > company, look up the list of directors? > > The obvious way would be to have flat tables for Person and Director, > and a third table called 'Directorship' with the columns: > - director_id (int) > - company_id (int) > > Then given a person, I could do a select on Directorship for rows > containing that person's id, then for each company ID found from that > select, I could do another select on Company for rows containing that > company ID. > > But is there a faster, less manual and higher-level way to do this? > > Thanks in advance > > Cheers > David > > > > > -- Très cordialement, Riccardo Cohen ligne directe : 02-47-49-63-24 ------------------------------------------- Articque http://www.articque.com 149 av Général de Gaulle 37230 Fondettes - France tel : 02-47-49-90-49 fax : 02-47-49-91-49 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "metakit" group. To post to this group, send email to metakit <at> googlegroups.com To unsubscribe from this group, send email to metakit-unsubscribe <at> googlegroups.com For more options, visit this group at http://groups.google.com/group/metakit?hl=en -~----------~----~----~----~------~----~------~--~---
RSS Feed