[Zope] ZODB for many-to-many relation
Milos Prudek
milos.prudek@worldonline.cz
Mon, 04 Jun 2001 19:06:33 +0200
I wonder if ZODB is suitable for the following problem, which I'll
describe in relational terms:
There are articles and writers (authors). Each article has at least one
writer, but it can have more than one writer. I need to list all
articles of a given writer, and all writers of a given article.
A pure relation database solution would be as follows:
To escape putting list of writers in 'articles' table, there is an
'article-writer' table, called 'aw'. It contains valid combination of
writers & articles.
aw table has these columns: a, w.
articles table has these columns: a,other-data
writers table has these columns: w,other-data
To list all articles of a writer No.1 :
SELECT aw.a, articles.other-data
FROM aw, articles, writers
WHERE
aw.w=1
AND
writers.w=1
AND
articles.a=aw.a
To list all writers of article No.2:
SELECT
FROM aw,articles,writers
WHERE
aw.a=2
AND
article.a=2
AND
writers.w=aw.w
Is there an OO solution to this situation?
--
Milos Prudek, confused ZODB newbie