Python GQL query not working [closed]
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
开发者_JAVA百科 Improve this question ID = int(data_key)
results = db.GqlQuery("SELECT * FROM PatientMeds WHERE patientinfo_ID='ID'")
where i have done wrong...
Thanks..
Use a parameter (examples 1, 2):
ID = int(data_key)
results = db.GqlQuery("SELECT * FROM PatientMeds WHERE patientinfo_ID=:1", ID)
# or
results = db.GqlQuery("SELECT * FROM PatientMeds WHERE patientinfo_ID=:id", id=ID)
You could also use the more "Pythonic" model API:
from path.to.your.models import PatientMeds
results = PatientMeds.all().filter('patientinfo_ID =', int(data_key))
精彩评论