First, remember that db.UserProperty gives you access only to a very
limited set of information about a user with a Google Account.  In
other words, you won't be able to manipulate the "user" that you're
pointing to in the datastore - you can only access certain properties
like email, username, and user_id, and you can't change any of those
properties (because they are pulled from the individual's Google
Account).  So if you have additional info you'll want to store about a
user (first name, lastname, birthday, whatever) you will probably want
something like:

class User(db.Model) {
  first_name = db.StringProperty(),
  last_name = db.StringProperty(),
  user = db.UserProperty(),
}

As for the rest of your question, it depends on how the data is going
to be accessed by your application.  For something like "Account" or
"Config" I imagine you're looking at a one-to-one relationship - one
Account entity per User entity.  So you might want to add a property
on your User class like "account = db.ReferenceProperty(Account)".
This is cheaper than having to do a query like Account.all().filter
("user =", users.get_current_user()) every time you want to get the
current user's account info.  Same with Config.

For Category, it depends on your usage pattern.  For example, if a
user is going to be a part of just a few categories, and you mostly
just want to grab those Category entities based on the currently
logged in user, you could add a property like this to your User model:
categories = db.ListProperty(db.Key).  Then if you want to get all of
a user's categories, you do something like db.get
(current_user.categories) which doesn't require a query, and is pretty
quick/cheap.  And if you want to query for all the users who are in
category X, you can do this query: User.all().filter("categories =",
category_x_key).  Pretty handy.

Recommended reading:
http://code.google.com/appengine/articles/modeling.html

On Jun 22, 7:13 am, Felipe Cavalcante <felipexcavalca...@gmail.com>
wrote:
> Hi,
>
> I want to create an application that has three tables (Categories,
> Account, Config). Every table has a property (user = db.UserProperty)
> to separate the content for a specific user.
>
> My question is: Is that the better form to separate information to
> every user? Is there any way to create a set of entities for every
> single user?
>
> I think I dont undersand (or have faith in) the concepts of BigTable
> yet. :)
>
> Any comment is welcome!
>
> Felipe
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to