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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:04:07+00:00 2026-06-16T11:04:07+00:00

My background with designing data stores comes from Core Data on iOS, which supports

  • 0

My background with designing data stores comes from Core Data on iOS, which supports properties having a one-to-many relationship with another entity.

I’m working on an App Engine project which currently has three entity types:

  • User, which represents a person using the app.
  • Project, which represents a project. A User may be associated with many projects.
  • Post, which is the main content behind a Project. A Project may have many posts.

Currently, User has a property, projects, that is a one-to-many relationship to Project entities. Project has a property, posts, that is a one-to-many relationship to Post entities.

In this case, is Datastore’s Reference Property or NDB’s Structured Property better for the job (and how are the two conceptually different)? Is there a better way to structure my data?

  • 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-16T11:04:08+00:00Added an answer on June 16, 2026 at 11:04 am

    By reference property you probably mean Key Property. This is a reference to another datastore entity. It is present in both db and ndb APIs. Using these, you can model a many to one relationship by pointing many entities to the key of another entity.

    Structured property is a completely different beast. It allows you to define a data structure, and then include it within another entity.

    Here’s an example from the docs where you include multiple addresses for a single contact:

    class Address(ndb.Model):
      type = ndb.StringProperty() # E.g., 'home', 'work'
      street = ndb.StringProperty()
      city = ndb.StringProperty()
    
    class Contact(ndb.Model):
      name = ndb.StringProperty()
      addresses = ndb.StructuredProperty(Address, repeated=True)
    
    guido = Contact(name='Guido',
                    addresses=[Address(type='home',
                                       city='Amsterdam'),
                               Address(type='work',
                                       street='Spear St',
                                       city='SF')])
    
    guido.put()
    

    For your specific application I’d recommend using NDB (it’s always best to use the latest version of the api available), with the following:

    Post model included under Project model as a repeated structured property.
    Users include a repeated KeyProperty that contains the keys of the Projects they have permissions to.

    To make it a bit more complex, you can create a another model to represent projects and permissions/roles, and then include that as a repeated structured property within the user model.

    The main reason you want to hang on to the keys, is to keep the data accessible in light of HRDs eventual consistency.

    Let me know if you need any more help on this.

    EDIT:

    To clarify, here’s the proposed structure:

    Models:

    • User
    • User-Project-Mapping (optional, needed to handle permissions)
    • Project
    • Post

    User model should contain User-Project-Mapping as repeated structured property.

    Project model should contain Post as repeated structured property.

    User-Project-Mapping only needs to contain Key reference to the Project and relevant permissions representation.

    Since this sounds like a commercial project, if you’d like further help with this, I’ll gladly consult for you. Hope you have enough to succeed!

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

Sidebar

Related Questions

So, not having come from a database design background, I've been tasked with designing
I have a Department entity which has a one-to-many relationship to an Employee entity.
Coming from a relational database background, as I'm sure many others are, I'm looking
Background I'm designing a Rails app to record research data. Most of it can
Background I am designing a system which enables the development of dynamic authentication schemes
Background: We are designing a physics app, that will do a lot of data
Background: I am designing a software application that reads millions or much more files
I am designing a Game and have a large background. The background it a
Background: We're building an application that allows our customers to supply data in a
Background: I'm using the (fantastic) Vim plugin python-mode , which includes the pep8 linter.

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.