The Python Oracle

How do I check for Existence of a Record in GAE

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Sunrise at the Stream

--

Chapters
00:00 How Do I Check For Existence Of A Record In Gae
00:55 Accepted Answer Score 2
01:08 Thank you

--

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

--

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