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 5978401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:30:38+00:00 2026-05-22T21:30:38+00:00

Using Google App Engine in Python and references, you automatically get a back reference

  • 0

Using Google App Engine in Python and references, you automatically get a back reference from the referenced object to the one you’re dealing with. This is described very well in the answer found here.

What I’d like to do is create a (simpler) one-to-many relationship, with each Group having a list of Tags, and each Tag belongs to only one Group. I picture it something like the following:

class Group(db.Model):
    # All of my group-specific data here.

class Tag(db.Model):
    text = db.StringProperty(required=True)
    group = db.ReferenceProperty(Group, collection='tags')

Assuming I understand everything correctly… In the above, you wind up with each Group having a tags property:

# Get the list of Tag objects that belong to a Group object
mytags = mygroup.tags 

My question is, is there a “standard” way to include that information in the Group object? When looking at the data models, you can’t see by looking at the Group object that it has a list of Tags that apply to it. I’d like to be able to define Group,Tags as something like

class Group(db.Model):
    # This should automatically be the same as the "tags" property that is
    # created for the Group model by the definition of the Tag model
    tags = db.ListProperty(db.Key)
    # All of my group-specific data here.

class Tag(db.Model):
    text = db.StringProperty(required=True)
    group = db.ReferenceProperty(Group, collection='tags', required=True)
    # Other tag specific information here (such as url, etc)

The idea being that I want to be able to see, when I look at the Group model, that it has a list of Tag objects as a property. It feels unnatural to me to have to look at the Tag model to know this information.

Note: It may be worth noting that I plan on having the Group in question be the parent (for the Entity Group) of each of it’s Tags. Any time I modify a Group, I will be updating it completely, replacing all of it’s Tags with new ones, and I want to get the correct list of them for the given “version” of the Group I’m looking at.

The use cases for my data include:

  • Update groups – create or update 6 groups. If create, then create the tags for the group. If update, completely replace the tags for the group (removing old ones) – happens every 5 minutes or so
  • Read recent groups – get the 6-20 (undecided yet) most recently modified groups, no need to load their tags
  • Read single group – get the information for a single group, including it’s tags (each one will have between 10 and 20 tags)
  • 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-22T21:30:38+00:00Added an answer on May 22, 2026 at 9:30 pm

    How are you going to query your tags, will you be concerned only with tags from a particular entity group? If that is the case, since you’re going to put your Tag entities in a Group entity’s entity group, the ReferenceProperty provides no real value. You could instead use tag_entity.key().parent() to get the Group entity’s key or tag_entity.parent() to get the Group entity itself. You could then use a ListProperty on Group to store the key_names of the tag entities (which I presume will be the actual ‘tag’).

    Since you are replacing all of a group’s tags any time the Group entity is updated, have you considered using a ListProperty to store your tags on directly on Group entity. Or, storing a list of tag key_names directly on Group. Either approach would make fetching all tags for a group quite easy and efficient.

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

Sidebar

Related Questions

I'm using Google App Engine python. I want to know what browser the user
I've been developing a Facebook app using Google App Engine in Python and the
How can i send Chat invitation over GTalk using Google App Engine(Python), i was
I'm using the Google App Engine with Python (Django). How to emulate SELECT *
I'm using Google App Engine and python for a web service. Some of the
I have problem with using template in Google App Engine by Python. the thing
I'm using Google App Engine (Python), and using OpenID for login. Specifically, I'm playing
I am developing an application on the Google App Engine using Python. I have
I'm building an application using Google app engine with python, and I'm stuck with
I've made a guestbook application using Google App Engine(GAE):python and the client is running

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.