Sunil Garg Sunil Garg - 1 year ago 60
Python Question

not able to retrieve data from datastore GAE

I have a Class User

class User(db.Model):
userId = db.StringProperty()
email = db.StringProperty()
channelToken = db.StringProperty()

I inserted a record with

user = User(key_name='1',userId='1',email='',channelToken='123')

It is perfectly inserted. But now when I am trying to retrieve it, it is showing an error

channelToken= db.GqlQuery("SELECT channelToken FROM User WHERE userId=1")"Found Channel : " + str(channelToken))

it is showing

<google.appengine.ext.db.GqlQuery object at 0xfe112370>" is not a string.

Am I doing something wrong ?

Answer Source


q = db.GqlQuery("SELECT channelToken FROM User WHERE userId=1") 
channelToken = q.get()

The logging was giving a memory location because GqlQuery returns an object.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download