asolfre / appengine-rest-server

Automatically exported from code.google.com/p/appengine-rest-server
Other
0 stars 0 forks source link

Not an issue, but feature request: Unique value return, and Bulk DELETE #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Feature request (hope this is OK?) - Else delete it

1. Basically a toggle to return a list of 'unique' values
2. Bulk (list of Keys) delete capability
3. Bulk (based on supported query) delete capability

I love this Project!  

Suits me nicely for getting back into webdev after many years.

I can build my app purely in JavaScript, using this REST API. No need to worry 
at all about any Python could to manage Data.

I am sort of achieving the first two items with Jquery, but it a headache and 
memory intensive on larger tables to paging/local javascript unique function 
(rather than doing it the google side)

I achieve the last one getting the keys into an array, then looping a DELETE 
request many times on single 'key' DELETE. This is very slow, and page normally 
times out. I know it can be better writing another Python interface to 
Datastore, but I think REST is all anyone needs to build a great App!

BTW - Excellent job guys, and keep up the great work.
Can you setup up a donate button?
At least I can fund you some new mouse pads : )

When I do eventually find a real issue, will certainly let you know !

Original issue reported on code.google.com by jayb...@gmail.com on 30 Sep 2011 at 4:27

GoogleCodeExporter commented 9 years ago
there is nothing wrong with feature enhancement requests.  generally, it's best 
to split them up (at least into related functionality).

a few comments:

1. i don't understand what you mean by this feature?  unique based on what 
criteria?

2,3. technically, these aren't really RESTful.  that said, i could certainly 
see them being useful.  i think you could achieve both using a "delete by 
query" functionality (2 is just a query with "fin_key=<list of keys>".

Original comment by jahlborn@gmail.com on 30 Sep 2011 at 12:53

GoogleCodeExporter commented 9 years ago
Thanks, 

Your right about two and three.
I currently run a query and get the keys I want to delete, then post a DELETE 
through each key in a jquery loop. The issues comes if the long list of keys 
requires paging (offset) to manage in browser, and also repeating DELETE a 
hundred times in separate calls leads to browser timeouts. e.g. "DELETE 
"/MyModel/<key"

what would be nice is a simple query, feq_example=entities&DELETE=yes
eg. the backend python returns the keys from query, and does a bulk python 
delete (noting the max entities limits for each bulk Python/Datastore request)

or at least a ?delete=<list of keys>, rather than just the available "DELETE 
"/MyModel/<key"

For Number 1, I simply meant returning a list of unique values. Since entity 
referencing not supported yet, I have the duplicate field in each row. I 
currently run the query, and use Javascript to sort and unique what is returned 
from the following (to build a menu). e.g.
/rest/Table?include_props=period,ordering=period
Your right though, it is not RESTful, rather just something I wanted to avoid 
in the browser if I could. 

Dont worry about 1 too much then, but ?delete=<list of keys> would be useful 
for bulk deletes, or at least the DELETE method supporting JSON list like bulk 
add/updates

Original comment by jayb...@gmail.com on 7 Oct 2011 at 4:01

GoogleCodeExporter commented 9 years ago
so, i've basically implemented 2,3 with delete by query.  if implemented like 
GET, the base url (no query parameters) means "get all".  i'm a little wary of 
supporting "delete all", though, seems too easy to shoot yourself in the foot.

Original comment by jahlborn@gmail.com on 18 Nov 2011 at 3:15

GoogleCodeExporter commented 9 years ago
i'm going to implement 2,3 as a general DELETE by query.  i'm a little 
concerned by the potential danger of this functionality, so there will be 2 new 
Dispatcher options: 'enable_delete_query' and 'enable_delete_all' (both 
disabled by default).

1. if 'enable_delete_query' is set to True on the Dispatcher, then the rest 
server will support query based deletes, e.g.: "DELETE 
/rest/Foo?fin_key=<key1>,<key2>" or "DELETE /rest/Foo?feq_author=bob", etc.

2. if 'enable_delete_query' +and+ 'enable_delete_all' are set to True on the 
Dispatcher, then the rest server will support "delete all", e.g.: "DELETE 
/rest/Foo"

Original comment by jahlborn@gmail.com on 19 Nov 2011 at 6:08

GoogleCodeExporter commented 9 years ago
2,3 are fixed in the trunk and will be in the 1.0.6 release.

if you would like to pursue feature 1, please submit a new feature request with 
more details on the functionality you are looking for.

Original comment by jahlborn@gmail.com on 19 Nov 2011 at 6:16

GoogleCodeExporter commented 9 years ago

Original comment by jahlborn@gmail.com on 6 Jun 2012 at 1:07