Datastore Model Design

6 views
Skip to first unread message

Pierre Lavignotte

unread,
Nov 20, 2009, 2:08:11 PM11/20/09
to Google App Engine
Hi,

I need help/advise designing the model of my GAE project.

Here is the list of the entities I need :
- User
- ToolBox
- Tool
- ToolBrand
- ToolCategory
- UserToolBox
- DIYSession
- UserToolUse


A User can pick Tools from the ToolBox and add them to its
UserToolBox.
Then a User can declare DIYSessions, using its own Tools, by creating
UserToolUse associations.
A User can browse any other User DIYSessions and see which tool have
been used.
I also need to expose some stats/graphs of the tools usage, globaly or
per User, as :
- tool usage count
- category usage count
- tool usage / year, month or season
- category usage / year, month or season
- tool brand usage / year, month or season

A the BigTable/Datastore doesn't allow to call agregation functions as
count(*), AVG() or SUM() neither to use joins, I thought that I could
create a tree structure that would make entity groups like that :
User => Year => Month = DIYSession => UserToolUsage

If each time a User creates a DIYSession and use Tools I can update
counters in parent Month, Year, and User entities, I think I'm done to
get my stats of tools usage by dates.

I could represent the ToolBox with another entity group :
ToolBox => ToolBrand => Tool

And each Tool could also have a date tree structure similar to the
User one to store counters :
... => Tool => Year => Month [containing a Key from a UserToolUsage]

The problem is that I'll also need the same tree structure for each
ToolBand, each ToolCategory, and duplicate everything so each User
will have its own UserToolBox and ToolCategory stats.

Technically, that's possible but it looks like each UserToolUsage
creation will generate many write operations to the User entity group,
but also to ToolBox entity group and to each Category the Tool is
associated to.
On the other hand, the read operations would be quite simple as all
the data is allready agregated.
Future stats or graphs needs won't be easy to develop as they will
mean structure updates, and a lot of data processing to fill new
counters.

Am I on the good way ?
Should I stick to a traditional relational database and use good old
JOINs to generate my data ?
I really would like to have the scalable facility from GAE...

Hope my english is good enough so someone hunderstand what I mean ;)

Thank you,
Pierre

Pierre Lavignotte

unread,
Nov 24, 2009, 4:52:27 PM11/24/09
to Google App Engine
No one to help me with my model ?

:'(

N. Rosencrantz

unread,
Nov 24, 2009, 5:05:41 PM11/24/09
to Google App Engine


On Nov 24, 4:52 pm, Pierre Lavignotte <pierre.lavigno...@gmail.com>
wrote:
> No one to help me with my model ?
>
> :'(
Always Craig Larman is good ref, creator model and factory design
patterns to R&D. My quick advice is avoid finegraining what I briefly
noticed and make more specific models since models mentioned look
slightly against DRY principle and awaited already defined elsewhere.
Like redefining classes "Point" or "Rectangle" which surely have API,
for rationale farther avoid nameconflicts too and choose names spec to
your app and keep telling how it advances. Guestbook example is very
good learning ground and all always most welcome checkin my project
montao.googlecode.com viewable from Fridge.Koolbusiness.com with
thanks to all engineering for all superiority /Niklas
Reply all
Reply to author
Forward
0 new messages