Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8657265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:28:52+00:00 2026-06-12T15:28:52+00:00

I have a problem with my app on Google AppEngine, especially with the datastore.

  • 0

I have a problem with my app on Google AppEngine, especially with the datastore.
The story is a bit long. My data model looks like this:

  1. Users can create entities. Each entity has the following properties:
    #1). the auto generated key. #2). The creator. #3). A number.
  2. In the app, I’m doing the following queries:
    a). Query entities by creator (#2). b). Query entities by the number property (#3). c). Query the entity by id(#1).

I’m using the low level datastore API. Now, here are several problematic approaches I have tried:

[Approach 1]: With the Datastore, if I make the entities parentless (no ancester), then things are good, especially the query ‘c’ can be easily achieved by Datastore.get(k).

Problem of Approach1: Since the datastore is “eventually consistent”, for query ‘a’ the result is ALWAYS not update to date. If a user creates an entity, then lists all entities he creates, the newly created one is always missing. It only appears by refresh in a few seconds later…Tried using memcache, does not help the case (or I’m not finding a good way?).

To overcome the problem above, I changed the data structure. Here’s [Approach 2]: when creating each entity, create a key based on the creator, and put the new entity as child of the key. So all entities created by a user are entities with an ancester. Thus query ‘a’ works in a timely manner, and query ‘b’ also seems to work.

The new problem of Approach2: For query ‘c’, it always returns nothing. Here’s my query ‘c’. Both of them can not find the entity, always:

method 1:
Entity en = datastore.get(k)

method2:

DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
Query q = new Query(kind)
    .setFilter(FilterOperator.EQUAL.of(Entity.KEY_RESERVED_PROPERTY, k));
Entity en = ds.prepare(q).asSingleEntity();

Another try: Approach3:
Group all entities under one ancestor. This overcomes the problem in Approach1, and can be queried with an ancestor filter so it’s ok to retrieve the result.

Problem of Approach3: Such structure groups all entities as one entity group. Per Google datastore specification, write operation can happen 5 times at the most per second. This is a limit I’d not want to hit…

I think this kind of data model is really common. Is there a proper way to structure the data? Any help is appreciated. Thanks…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:28:53+00:00Added an answer on June 12, 2026 at 3:28 pm

    I’m not quite sure what you are asking due to the formatting of your question but…

    When you query by ID you also have to include the parent key. The key includes both the parents and the child data, and if you are only using the child data then it won’t return what you are looking for as that’s not it’s “name”. The full path (ancestor/child) is it’s name.

    So include the parent in the key you are constructing, then get it.

    key = parent, parent_ID, child, child_ID
    

    as

    key = child, ID
    

    won’t work if it has a parent, as the key is incomplete and it can’t return the data you want like that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a frustrating issue that my app on Google Appengine throws NullPointerException like:
I have just encountered very strange problem - my GWT app hosted on Google
I have problem with using template in Google App Engine by Python. the thing
I have a problem with the Google App Engine JDO implementation that I cannot
I have been working on the app engine for some time, and this problem
I have problem with Stripes forms in the application for Google App Engine. I
I using google app engine, in 0.96 I have no problem to include a
I have a curious problem: My app is distributed through ClickOnce. I recently installed
I have problem in declaring the intents on my app. I have a form
I have a Problem in my App with the Dirty Memory Size and want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.