[Tutor] Datamodelling

charlie@begeistert.org charlie@begeistert.org
Sun Mar 9 17:42:02 2003


On 2003-03-09 at 23:30:30 [+0100], you wrote:
> Shelve would seem a reasonable starting point. Think of it as a single 
> table database!

> You can use multiple shelves but then you have to do the joins manually.

This is what I've started to do. Once I came up with a way of generating 
unique IDs I started moving along quite quickly - I have an "ids" value in 
each table which I increment for each new entry and use a string of for the 
ids.

It's been a lot of fun migrating the MySQL based PHP stuff to pure Python 
with shelve. The DB is currently ruined and I don't have the rights to 
change it anyway. By far the best thing has been using dispatching instead 
of if/elif/else. Thanx goes to the list + cookbook for pointing out this 
wonderful concept!
  
> Depends on what your members do.
> Classes should be based on behaviour rather than data where possible.
>  
> If your members will add themsxelves, edit their entries or perform any 
> other functions then by all means create classes for them If they just 
> contain 
> dumb data that you extract some other way then maybe a simple tuple or 
> list or dictionary is all you need.

Yeah, as soon as started trying to model what I wanted in classes I could 
see it wasn't going to give me the aggregate functions I can get from other 
data types. Wonder how object-oriented DBs do it.
-- 
Charlie Clark
Chief Chaos Coordinator
BeGeistert 010 - Brave New World
26 + 27 April 2003