28 Apr 10:42
emulating 'nested tables'
From: David McNab <david <at> rebirthing.co.nz>
Subject: emulating 'nested tables'
Newsgroups: gmane.comp.python.sqlobject
Date: 2008-04-28 08:43:41 GMT
Subject: emulating 'nested tables'
Newsgroups: gmane.comp.python.sqlobject
Date: 2008-04-28 08:43:41 GMT
Hi,
I've prototyped a database using Metakit (which allows tables to have
nested tables as columns), and want to migrate it over to use SQLObject.
Consider:
class Foo(SQLObject):
someattr = IntCol()
otherattr = StringCol()
things = MultipleJoin("Thing")
class Thing(SQLObject):
attr1 = BoolCol()
attr2 = StringCol()
foo = ForeignKey("Foo")
This will give an effect similar to 'nested tables', since the '.things'
attribute of any Foo object will yield a list of Thing records.
But if the database grows to having tens of thousands, even millions of
rows in each table, then accessing '.things' could prove pretty slow.
Another option is to look into dynamic creation of tables, where for
each Foo object I create a dynamic Thing-like class. But I don't know
how I could get the convenience similar to just fetching '.things'
attributes of Foo objects to access each dynamic table.
Can anyone suggest the best way to get decent scalable performance with
this scenario?
(Continue reading)
RSS Feed