How to remove rows from the data store that our application uses in Google appengine?

All videos and tutorials show only how to add material to the data warehouse and get through GqlQuery. How to remove material from the data warehouse? Is the DELETE FROM query mytable WHERE condition met?

+4
source share
2 answers

The answers of systempuntout and Forest are correct - however, you may know that you can also combine some data warehouse operations to improve efficiency (see this App Engine blog post ).

You can modify the systempuntout response as follows:

q = db.GqlQuery("SELECT * FROM Foo") results = q.fetch(10) db.delete(results) 

Instead of a two-way transition, one operation is deleted for each item to remove them.

+6
source

The GQL language is read-only, and it is useful for retrieving entities or keys from the App Engine datastore.

In DELETE expressions, you must use the delete method provided by the Datastore API .
Example:

 q = db.GqlQuery("SELECT * FROM Foo") results = q.fetch(10) for result in results: result.delete() 
+1
source

Source: https://habr.com/ru/post/1345311/


All Articles