开发者

Python GQL query not working [closed]

开发者 https://www.devze.com 2023-02-10 04:24 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.

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))
0

精彩评论

暂无评论...
验证码 换一张
取 消