简体   繁体   中英

How to store user-specific data from Android in Google App Engine Datastore. Ancestor or not?

I currently have an Android app which uses 3 SQLite database tables and I want to store this data on the cloud in my Java-based GAE app. It will be used as backup and also, the user will be able to view it in their browser upon logging in. The user is entering data into the Android app so all the data in the 3 tables belongs to that user. Is there a recommended way of storing this type of user-specific data? Should I store user email with each entity in order to identify it or have a User entity as the parent and all the entities belonging to this user as the children? Are there any advantages of using a parent in this case?

It all depends on how many records you have for a single user, how frequently these records are updated, and how you access this data (what kind of queries you need, etc.) So there is no simple and definitive answer to your question.

Most likely, you will be fine with either approach unless you have thousands of records per user and they update them every few minutes, at which point you may run into some limitations.

Note that you don't need to include an email address to identify each record. Typically, you create a user entity first, and then you use an id of this user entity (a Long) to identify all other entities that are related to this user.

我的两分钱。与Sqlite不同,Google App Engine不是关系数据库,因此将您的SQlite数据保存到GAE并不是一件容易的事。但是,您可以在GAE上创建一个应用程序,在其中您可以使用来自ur app的useremail作为实体键。然后您可以根据此键检索特定于用户的信息。在这种情况下,您需要做的所有(好,最重要的事情)是找到一种方法,将数据从您的应用发送到GAE。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM