The Python Oracle

How do I check for Existence of a Record in GAE

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Industries in Orbit Looping

--

Chapters
00:00 Question
01:16 Accepted answer (Score 2)
01:37 Thank you

--

Full question
https://stackoverflow.com/questions/2751...

Accepted answer links:
[get()]: http://code.google.com/appengine/docs/py...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #django #googleappengine #djangomodels

#avk47



ACCEPTED ANSWER

Score 2


I am afraid you forgot to execute the query. Try the get() method. It returns the first result, or None if the query returned no results.

profile = db.GqlQuery("SELECT * FROM Profile WHERE account = :1",
                        users.get_current_user()).get()