开发者

Python GQL query not working [closed]

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜