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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:58:03+00:00 2026-06-07T06:58:03+00:00

I ever use get_by_id for get an entity from datastore and never use Ancestor

  • 0

I ever use get_by_id for get an entity from datastore and never use Ancestor Paths. But the complexity of my models has made it necessary. In fact Ancestor Paths solve a big problem but now when I try to get_by_id an entity return None if the entity have the parent key. This means that I need to add the parent Key:

entity = MyModel.get_by_id(id)

This would becomes:

entity = MyModel.get_by_id(id, parent=key)

How to build the parent Key?

edit:

At this point I prefer to leave ancestor paths and add another keyproperty.

  • 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-07T06:58:05+00:00Added an answer on June 7, 2026 at 6:58 am

    If you want using entity group you can simply create a key like that:

    key_parent = db.Key.from_path('MyModelParent', 'id_parent') # You don't have to create this kind in the datastore.
    
    id = int(self.request.get('id'))
    entity = MyModel.get_by_id(id, parent=key_parent)
    

    I notice that: You use an upper case for the key parameter. It’s parent not Parent.

    entity = MyModel.get_by_id(id, Parent=key) # Wrong
    entity = MyModel.get_by_id(id, parent=key)
    

    Oh, you are using NDB:

    key_parent = ndb.Key('MyModelParent', 'id_parent')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I haven't really ever made much use of the .htaccess file but I would
I've never had the need to really ever use any of the .NET Data
I do not really use any try/catches in my code ever but I'm trying
i use a php class to make tag cloud from article, but i want
If I only ever use one Statement at a time would it be worthwhile
Do you ever use a separate table for generating artificial primary keys for DB
when ever i use window.location.href=//some url it always open a new window, this only
I have this big doubt. When ever i use base64Binary in an .xsd schema
I'm using PyDev 2.5 in eclipse. When ever I use a raw_input command and
Ever since I created this Rails 3.2.3 project to use MiniTest, I have been

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.