Re: metakit relational questions

Riccardo Cohen <[email protected]> Tue, 26 Jun 2007 09:12:29 +0200
Newsgroups gmane.comp.db.metakit
Organization Articque
Message-ID <[email protected]>
in the page http://support.articque.com/metakit/metakit_tutorial.html
you will find a small example of relation

davidm wrote:
> Hi,
>=20
> 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.
>=20
> But how do you do two tables that relate to each other?
>=20
> For example, imagine one table called 'Director' which has the
> columns:
>  - name (string)
>  - age (int)
>  - companies (related join to Company)
>=20
> and another table called 'Company', which has the columns:
>  - name (string)
>  - directors (related join to Person)
>=20
> 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.
>=20
> I'm familiar with SQLObject, where this can be very easily
> accomplished with 'RelatedJoin' column types.
>=20
> 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?
>=20
> 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)
>=20
> 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.
>=20
> But is there a faster, less manual and higher-level way to do this?
>=20
> Thanks in advance
>=20
> Cheers
> David
>=20
>=20
> >=20
>=20

--=20
Tr=E8s cordialement,

Riccardo Cohen
ligne directe : 02-47-49-63-24
-------------------------------------------
Articque
http://www.articque.com
149 av G=E9n=E9ral 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 [email protected]
To unsubscribe from this group, send email to metakit-unsubscribe@googlegrou=
ps.com
For more options, visit this group at http://groups.google.com/group/metakit=
?hl=3Den
-~----------~----~----~----~------~----~------~--~---