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

  • SEARCH
  • Home
  • 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 6641901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:51:57+00:00 2026-05-25T23:51:57+00:00

I have a datastore thats has ~850 groups and ~19,000 items. Each item may

  • 0

I have a datastore thats has ~850 groups and ~19,000 items. Each item may belong to only one group, I have two models in my app that represent a Group and an Item:

class Group(db.Model):
    Id = db.IntegerProperty()
    Name = db.StringProperty()
    # ... some other  properties

class Item(db.Model):
    Id = db.IntegerProperty()
    Name = db.StringProperty()
    Group = db.ReferenceProperty(Group, collection_name="groupItems")
    # ... some other properties

I can use the datastore admin to view a specific item (i.e. WHERE Id = 34) and see that it is connected correctly to a Group –

SELECT * FROM Item WHERE Id = 34

This gives me a group with the following properties:

Decoded entity key: Group: id=10321
Entity key: agtzfmV2ZS1taW5lcnIMCxIFR3JvdXAY0VAM
Id: 18

If I alter my GQL query to retrieve all items for this Group I get no results! –

SELECT * FROM Item WHERE Group = KEY('agtzfmV2ZS1taW5lcnIMCxIFR3JvdXAY0VAM') -- No Results
SELECT * FROM Item WHERE Group = KEY('Group', 'agtzfmV2ZS1taW5lcnIMCxIFR3JvdXAY0VAM') -- No Results

If I retrieve just the group, it works as expected –

SELECT * FROM Group WHERE __key__ = KEY('agtzfmV2ZS1taW5lcnIMCxIFR3JvdXAY0VAM')  -- Returns 1 Group

This equally applies in my Python code. Calling:

group = Group.gql("WHERE Id = :1", 18).get()
items = Item.gql("WHERE Group = :1", group).fetch(50)

results in a list containing no items. Similarly

group.groupItems.fetch(500) -- Returns no results

My question is – am I doing something particularly stupid? I have created a dummy project with a similar structure to prove to myself that it wasnt a naming problem (i.e. that Group wasn’t a reserved word) and that returns just fine. (Attached if anyone is interested).

What am I doing wrong?

EDIT 1 :

As requested, here’s the creation code. Reader is a csv reader (using the inbuilt csv library) which opens a CSV stored in the BLOB store. For all intents and purposes its merely parsing a CSV file. As mentioned above. In the data viewer through my dashboard my Item is bound correctly to a group (a group is listed alongside the item and I can click through it’s link to view the group) however when passing the group as part of a filter to the Item no results are returned –

Group –

reader = UploaderBase().open_from_blobstore(Settings().get_group_csv_key())
upNum = 0
groupsToPut = []
for row in reader:
    group = Group(Id=int(row[0]))
    group.Name = row[2]
    groupsToPut.append(group)

db.put(groupsToPut)

Item –

groupCache = {}
for group in Group.all().fetch(1000):
    groupCache[group.Id] = group
logging.info("Cached %d group entries locally" % len(groupCache))

items = []
reader = UploaderBase().open_from_blobstore(Settings().get_items_csv_key())
upNum = 0
for row in reader:
    logging.debug("Adding row %d" % upNum)
    item = Item(Id=int(row[0]))

    if not row[1] is None and  row[1] != "":
        item.Group = groupCache[int(row[1])]

    item.Name = row[2]
    items.append(item)

db.put(items)
  • 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-05-25T23:51:57+00:00Added an answer on May 25, 2026 at 11:51 pm

    The most likely explanation is that when you inserted the data, the reference property was set as indexed=False. Changes to a model only affect entities written after the model was changed, so rows inserted while indexing was disabled for that column will not have index rows.

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

Sidebar

Related Questions

I have a datastore model representing items in an ecommerce site: class Item(db.Model): CSIN
I have an entity in my app engine datastore. There's actually only one instance
I have a datastore object that uses one of the fields in the class
The app engine datastore, of course, has downtime . However, I'd like to have
So I have a ExtJs 4 Grid Panel that has two columns. Column ONE
I have updated my model in Datastore so now it has an additional field.
I have created a multi column datastore on a table that allows me to
I have an Expando model kind in my App Engine datastore and I'm setting
Anyone have sugestion or example on how displaying Google Datastore records table with pagination
I have a GWT page with a listing (from the datastore) on it. I

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.