python - Google App Engine Datastore delete entity by properties -


i made simple login page python , datastore. user model following.

class user(db.model):     name = db.stringproperty()     password = db.stringproperty() 

question 1:

lets know name , password of specific user. how can delete entity database has specified name , password properties?

question 2:

lets have user entity "john" name , "1234" password. given these 2 things, how can change name property "john" "marcus"?

question 3:

is possible achieve without using gqlquery?

these things explained in documentation. (which states should not using old db api, ndb one, never mind.)

1.

user = user.all().filter('name =', name).filter('password =', password).get() if user:     user.delete() 

2.

user = user.all().filter('name =', 'john').filter('password =', '1234').get() if user:     user.name = 'marcus'     user.put() 
  1. there nothing requires gqlquery. gql interface underlying datastore rpcs: not in sense more "native" db or ndb apis, , not "compile down" gql in same way (eg) django's orm compiles down sql.

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -