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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:00:08+00:00 2026-06-11T06:00:08+00:00

Below is python code where I am trying to get reservations information from the

  • 0

Below is python code where I am trying to get reservations information from the Reservations Model.

    i=0
    for c in courts:
        court = names[i]
        i=i+1
        c_key=c.key()
        logging.info("c_key: %s " % c_key)
        weekday_key= db.Key.from_path('Courts', 'c_key', 'Days', weekday)
        logging.info("weekday_key: %s " % weekday_key)
        logging.info("weekday: %s " % weekday)
        logging.info("court: %s " % court)
        reservation = db.Query(Reservations)
        nlimit=2*len(times)
        reservations = reservation.fetch(limit=nlimit)
        logging.info("reservations: %s " % len(reservations))

There are only two court entities in my Courts database, court1 and court2.
There also only 14 weekday entities in my Days database, 7 for court1 and 7 for court2, named Sunday, … , Saturday. In the current example I am trying to get the key for the 2 Monday Days, one for court1 and one for court2.
I don’t understand why according to the log below, I am getting the same weekday_key for the two different courts which have different keys c_key themselves.

In the log below, whether I put into the db.Key.from_path( command ‘c_key’ or ‘court’ I get exactly the same result, which shows that the values of the 2 weekday_keys are identical, not different as I expected.

INFO     2012-09-10 21:25:19,189 views.py:226] c_key: ag1kZXZ-c2NoZWR1bGVycicLEglMb2NhdGlvbnMiBlJvZ2VycwwLEgZDb3VydHMiBmNvdXJ0MQw 
INFO     2012-09-10 21:25:19,189 views.py:228] weekday_key: ag1kZXZ-c2NoZWR1bGVyciELEgZDb3VydHMiBWNfa2V5DAsSBERheXMiBk1vbmRheQw 
INFO     2012-09-10 21:25:19,189 views.py:229] weekday: Monday 
INFO     2012-09-10 21:25:19,189 views.py:230] court: court1 
INFO     2012-09-10 21:25:19,192 views.py:235] reservations: 1 
INFO     2012-09-10 21:25:19,192 views.py:226] c_key: ag1kZXZ-c2NoZWR1bGVycicLEglMb2NhdGlvbnMiBlJvZ2VycwwLEgZDb3VydHMiBmNvdXJ0Mgw 
INFO     2012-09-10 21:25:19,192 views.py:228] weekday_key: ag1kZXZ-c2NoZWR1bGVyciELEgZDb3VydHMiBWNfa2V5DAsSBERheXMiBk1vbmRheQw 
INFO     2012-09-10 21:25:19,192 views.py:229] weekday: Monday 
INFO     2012-09-10 21:25:19,192 views.py:230] court: court2 
INFO     2012-09-10 21:25:19,195 views.py:235] reservations: 1 

My Models are as follows.

class Courts(db.Model):    #parent is Locations, courtname is key_name
    location = db.ReferenceProperty(Locations)
    timezone = db.StringProperty()

class Days (db.Model):    #parent is Courts, name is key_name, day of week
    court = db.ReferenceProperty(Courts)
    startTime = db.ListProperty(int)
    endTime = db.ListProperty(int)

class Reservations(db.Model):    #parent is Days, hour, minute HH:MM is key_name
    weekday = db.ReferenceProperty(Days)
    day = db.IntegerProperty()
    nowweekday = db.IntegerProperty()
    name = db.StringProperty()
    hour = db.IntegerProperty()
    minute = db.IntegerProperty()
  • 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-11T06:00:10+00:00Added an answer on June 11, 2026 at 6:00 am

    You’re calculating the keys using the string 'c_key' each time, not the value of the variable c_key.

    However even if you fix this it still won’t work, since you want the ID of the court, not the full key path.

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

Sidebar

Related Questions

I am trying to get information from an SQL database using python I was
I am trying to implement this package http://code.google.com/p/python-progressbar/ when downloading a file like below:
I'm learning Python and trying to test some rest web_service applications. From the below
I have been trying to debug the below python cgi code but doesn't seems
I am trying to capture from a Sony Handicam DCR-HC38, running the code below,
I am trying translate this Python code to Java from the presentation Building Scalable,
I have a python psp page code is shown below. Currently it only prints
In the code shown below, I need to manipulate the time var in python
The example below is from a REST database driver on Python 2.7. In the
am not quite advanced python user, I am stuck trying to populate the below

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.