File tree Expand file tree Collapse file tree 2 files changed +29
-8
lines changed Expand file tree Collapse file tree 2 files changed +29
-8
lines changed Original file line number Diff line number Diff line change @@ -271,11 +271,31 @@ Count the number of inserted entities. This method corresponds to a [POST reques
271
271
from pyslicer import SlicingDice
272
272
client = SlicingDice(' MASTER_OR_READ_API_KEY' , uses_test_endpoint = False )
273
273
274
- tables = {
275
- ' tables' : [
276
- ' default'
277
- ]
274
+ print client.count_entity_total()
275
+ ```
276
+
277
+ #### Output example
278
+
279
+ ``` json
280
+ {
281
+ "status" : " success" ,
282
+ "result" : {
283
+ "total" : 42
284
+ },
285
+ "took" : 0.103
278
286
}
287
+ ```
288
+
289
+ ### ` count_entity_total(tables) `
290
+ Count the total number of inserted entities in the given tables. This method corresponds to a [ POST request at /query/count/entity/total] ( http://panel.slicingdice.com/docs/#api-details-api-endpoints-get-query-count-entity-total ) .
291
+
292
+ #### Request example
293
+
294
+ ``` python
295
+ from pyslicer import SlicingDice
296
+ client = SlicingDice(' MASTER_OR_READ_API_KEY' , uses_test_endpoint = False )
297
+
298
+ tables = [' default' ]
279
299
280
300
print client.count_entity_total(tables)
281
301
```
Original file line number Diff line number Diff line change @@ -213,21 +213,22 @@ def count_entity(self, query):
213
213
url = base_url + URLResources .QUERY_COUNT_ENTITY
214
214
return self ._count_query_wrapper (url , query )
215
215
216
- def count_entity_total (self , tables = None ):
216
+ def count_entity_total (self , tables = [] ):
217
217
"""Make a count entity total query
218
218
219
219
Keyword arguments:
220
220
tables -- A dictionary containing the tables in which
221
221
the total query will be performed
222
222
"""
223
- if tables is None :
224
- tables = {}
223
+ query = {
224
+ 'tables' : tables
225
+ }
225
226
base_url = self ._wrapper_test ()
226
227
url = base_url + URLResources .QUERY_COUNT_ENTITY_TOTAL
227
228
return self ._make_request (
228
229
url = url ,
229
230
req_type = "post" ,
230
- json_data = ujson .dumps (tables ),
231
+ json_data = ujson .dumps (query ),
231
232
key_level = 0 )
232
233
233
234
def count_event (self , query ):
You can’t perform that action at this time.
0 commit comments