Skip to content

Commit 867ec60

Browse files
Update count_entity_total method and README example
1 parent 69b5835 commit 867ec60

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,21 @@ print client.exists_entity(ids)
263263
```
264264

265265
### `count_entity_total()`
266-
Count the number of inserted entities. This method corresponds to a [GET request at /query/count/entity/total](http://panel.slicingdice.com/docs/#api-details-api-endpoints-get-query-count-entity-total).
266+
Count the number of inserted entities. 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).
267267

268268
#### Request example
269269

270270
```python
271271
from pyslicer import SlicingDice
272272
client = SlicingDice('MASTER_OR_READ_API_KEY', uses_test_endpoint=False)
273-
print client.count_entity_total()
273+
274+
tables = {
275+
'tables': [
276+
'default'
277+
]
278+
}
279+
280+
print client.count_entity_total(tables)
274281
```
275282

276283
#### Output example

pyslicer/client.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,21 @@ def count_entity(self, query):
213213
url = base_url + URLResources.QUERY_COUNT_ENTITY
214214
return self._count_query_wrapper(url, query)
215215

216-
def count_entity_total(self):
217-
"""Make a count entity total query"""
216+
def count_entity_total(self, tables=None):
217+
"""Make a count entity total query
218+
219+
Keyword arguments:
220+
tables -- A dictionary containing the tables in which
221+
the total query will be performed
222+
"""
223+
if tables is None:
224+
tables = {}
218225
base_url = self._wrapper_test()
219226
url = base_url + URLResources.QUERY_COUNT_ENTITY_TOTAL
220227
return self._make_request(
221228
url=url,
222-
req_type="get",
229+
req_type="post",
230+
json_data=ujson.dumps(tables),
223231
key_level=0)
224232

225233
def count_event(self, query):

0 commit comments

Comments
 (0)