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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:13:13+00:00 2026-05-27T11:13:13+00:00

This is next step to this question, where I need to run queries and

  • 0

This is next step to this question, where I need to run queries and apply filters.
Here is my Model

from google.appengine.ext import db
Class Car(db.Model):
    name=db.StringProperty()
    model=db.StringProperty()
    mileage=db.IntegerProperty()
    person = db.ReferenceProperty(Person, collection_name='person')

Class Person(db.Model):
    name=db.StringProperty()
    age=db.IntegerProperty()

Question : For a Person I want to get all the cars he own

Approach : Get all the cars and apply filter on person whose name is “Random”
I tried the following but it doesn’t work

s = Car.all()
s.filter('person.name =', 'Random') # It fails here
result = s.fetch(1)[0] # just first result for now
print result.text
print result.votes
print result.page.language

How can I make this query run?
Thank you

  • 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-27T11:13:14+00:00Added an answer on May 27, 2026 at 11:13 am

    You can only use filter on indexed attributes. person.name is from other entity! In sql you would need to use join (which is impossible when data grows big), in google bigtable like in many other non-relational databases tables join is not possible. Luckily your case is very simple, you can select all cars if you know persons key:

    >>> person = Person.all().filter('name =', 'Mr. Random').fetch(1)[0]
    >>> cars = Car.all().filter('person =', person.key())
    

    If you had used a more reasonable value for collection_name

    Class Car(db.Model):
        ...    
        person = db.ReferenceProperty(Person, collection_name='cars_collection')
    

    you could access all cars like this:

    >>> person = Person.all().filter('name =', 'Mr. Random').fetch(1)[0]
    >>> mrs_randoms_cars = person.cars_collection
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is an extension / next step of this question I asked a few
This helpful idea from Andy Gaskell supports 50% of my next question: I'd like
This question is the next step in my project of Optimizing a folder/directory of
I have the following jQuery which I need adapting: $(document).ready(function(){ $(.rss-popup a).hover(function() { $(this).next(em).stop(true,
This is a followup on the question: ASP.NET next/previous buttons to display single row
This question follows on from Assembly does not allow partially trusted callers when using
I've seen this question rise here and there a few times, but I never
A few days ago i asked this question: Displaying images from Facebook photo albums
This question may be beyond the scope of a simple answer here at stack
We've developed a service, which sends e-mails... quite trivial at this step. The next

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.