@@ -34,9 +34,11 @@ If this is the first register ever entered into the system,
3434
3535``` python
3636from pyslicer import SlicingDice
37+ import asyncio
3738
3839# Configure the client
3940client = SlicingDice(master_key = ' API_KEY' )
41+ loop = asyncio.get_event_loop()
4042
4143# Inserting data
4244insert_data = {
@@ -45,7 +47,7 @@ insert_data = {
4547 },
4648 " auto-create" : [" dimension" , " column" ]
4749}
48- client.insert(insert_data)
50+ loop.run_until_complete( client.insert(insert_data) )
4951
5052# Querying data
5153query_data = {
@@ -61,7 +63,7 @@ query_data = {
6163 }
6264 ]
6365}
64- print (client.count_entity(query_data))
66+ print (loop.run_until_complete( client.count_entity(query_data) ))
6567```
6668
6769## Reference
@@ -89,8 +91,10 @@ Get information about current database(related to api keys informed on construct
8991
9092``` python
9193from pyslicer import SlicingDice
94+ import asyncio
9295client = SlicingDice(' MASTER_API_KEY' )
93- print (client.get_database())
96+ loop = asyncio.get_event_loop()
97+ print (loop.run_until_complete(client.get_database()))
9498```
9599
96100#### Output example
@@ -115,8 +119,12 @@ Get all created columns, both active and inactive ones. This method corresponds
115119
116120``` python
117121from pyslicer import SlicingDice
122+ import asyncio
123+
118124client = SlicingDice(' MASTER_API_KEY' )
119- print (client.get_columns())
125+ loop = asyncio.get_event_loop()
126+
127+ print (loop.run_until_complete(client.get_columns()))
120128```
121129
122130#### Output example
@@ -154,15 +162,19 @@ Create a new column. This method corresponds to a [POST request at /column](http
154162
155163``` python
156164from pyslicer import SlicingDice
165+ import asyncio
166+
157167client = SlicingDice(' MASTER_API_KEY' )
168+ loop = asyncio.get_event_loop()
169+
158170column = {
159171 " name" : " Year" ,
160172 " api-name" : " year" ,
161173 " type" : " integer" ,
162174 " description" : " Year of manufacturing" ,
163175 " storage" : " latest-value"
164176}
165- print (client.create_column(column))
177+ print (loop.run_until_complete( client.create_column(column) ))
166178```
167179
168180#### Output example
@@ -181,7 +193,11 @@ Insert data to existing entities or create new entities, if necessary. This meth
181193
182194``` python
183195from pyslicer import SlicingDice
196+ import asyncio
197+
184198client = SlicingDice(' MASTER_OR_WRITE_API_KEY' )
199+ loop = asyncio.get_event_loop()
200+
185201insert_data = {
186202 " user1@slicingdice.com" : {
187203 " car-model" : " Ford Ka" ,
@@ -217,7 +233,7 @@ insert_data = {
217233 },
218234 " auto-create" : [" dimension" , " column" ]
219235}
220- print (client.insert(insert_data))
236+ print (loop.run_until_complete( client.insert(insert_data) ))
221237```
222238
223239#### Output example
@@ -238,13 +254,17 @@ Verify which entities exist in a dimension (uses `default` dimension if not prov
238254
239255``` python
240256from pyslicer import SlicingDice
257+ import asyncio
258+
241259client = SlicingDice(' MASTER_OR_READ_API_KEY' )
260+ loop = asyncio.get_event_loop()
261+
242262ids = [
243263 " user1@slicingdice.com" ,
244264 " user2@slicingdice.com" ,
245265 " user3@slicingdice.com"
246266]
247- print (client.exists_entity(ids))
267+ print (loop.run_until_complete( client.exists_entity(ids) ))
248268```
249269
250270#### Output example
@@ -270,9 +290,11 @@ Count the number of inserted entities in the whole database. This method corresp
270290
271291``` python
272292from pyslicer import SlicingDice
293+ import asyncio
273294client = SlicingDice(' MASTER_OR_READ_API_KEY' )
295+ loop = asyncio.get_event_loop()
274296
275- print (client.count_entity_total())
297+ print (loop.run_until_complete( client.count_entity_total() ))
276298```
277299
278300#### Output example
@@ -294,11 +316,14 @@ Count the total number of inserted entities in the given dimensions. This method
294316
295317``` python
296318from pyslicer import SlicingDice
319+ import asyncio
320+
297321client = SlicingDice(' MASTER_OR_READ_API_KEY' )
322+ loop = asyncio.get_event_loop()
298323
299324dimensions = [' default' ]
300325
301- print (client.count_entity_total(dimensions))
326+ print (loop.run_until_complete( client.count_entity_total(dimensions) ))
302327```
303328
304329#### Output example
@@ -320,7 +345,11 @@ Count the number of entities matching the given query. This method corresponds t
320345
321346``` python
322347from pyslicer import SlicingDice
348+ import asyncio
349+
323350client = SlicingDice(' MASTER_OR_READ_API_KEY' )
351+ loop = asyncio.get_event_loop()
352+
324353query = [
325354 {
326355 " query-name" : " corolla-or-fit" ,
@@ -351,7 +380,7 @@ query = [
351380 " bypass-cache" : False
352381 }
353382]
354- print (client.count_entity(query))
383+ print (loop.run_until_complete( client.count_entity(query) ))
355384```
356385
357386#### Output example
@@ -374,7 +403,11 @@ Count the number of occurrences for time-series events matching the given query.
374403
375404``` python
376405from pyslicer import SlicingDice
406+ import asyncio
407+
377408client = SlicingDice(' MASTER_OR_READ_API_KEY' )
409+ loop = asyncio.get_event_loop()
410+
378411query = [
379412 {
380413 " query-name" : " test-drives-in-ny" ,
@@ -407,7 +440,7 @@ query = [
407440 " bypass-cache" : True
408441 }
409442]
410- print (client.count_event(query))
443+ print (loop.run_until_complete( client.count_event(query) ))
411444```
412445
413446#### Output example
@@ -430,7 +463,10 @@ Return the top values for entities matching the given query. This method corresp
430463
431464``` python
432465from pyslicer import SlicingDice
466+ import asyncio
467+
433468client = SlicingDice(' MASTER_OR_READ_API_KEY' )
469+ loop = asyncio.get_event_loop()
434470query = {
435471 " car-year" : {
436472 " year" : 2
@@ -439,7 +475,7 @@ query = {
439475 " car-model" : 3
440476 }
441477}
442- print (client.top_values(query))
478+ print (loop.run_until_complete( client.top_values(query) ))
443479```
444480
445481#### Output example
@@ -488,7 +524,10 @@ Return the aggregation of all columns in the given query. This method correspond
488524
489525``` python
490526from pyslicer import SlicingDice
527+ import asyncio
528+
491529client = SlicingDice(' MASTER_OR_READ_API_KEY' )
530+ loop = asyncio.get_event_loop()
492531query = {
493532 " query" : [
494533 {
@@ -500,7 +539,7 @@ query = {
500539 }
501540 ]
502541}
503- print (client.aggregation(query))
542+ print (loop.run_until_complete( client.aggregation(query) ))
504543```
505544
506545#### Output example
@@ -537,8 +576,11 @@ Get all saved queries. This method corresponds to a [GET request at /query/saved
537576
538577``` python
539578from pyslicer import SlicingDice
579+ import asyncio
580+
540581client = SlicingDice(' MASTER_API_KEY' )
541- print (client.get_saved_queries())
582+ loop = asyncio.get_event_loop()
583+ print (loop.run_until_complete(client.get_saved_queries()))
542584```
543585
544586#### Output example
@@ -588,7 +630,10 @@ Create a saved query at SlicingDice. This method corresponds to a [POST request
588630
589631``` python
590632from pyslicer import SlicingDice
633+ import asyncio
634+
591635client = SlicingDice(' MASTER_API_KEY' )
636+ loop = asyncio.get_event_loop()
592637query = {
593638 " name" : " my-saved-query" ,
594639 " type" : " count/entity" ,
@@ -607,7 +652,7 @@ query = {
607652 ],
608653 " cache-period" : 100
609654}
610- print (client.create_saved_query(query))
655+ print (loop.run_until_complete( client.create_saved_query(query) ))
611656```
612657
613658#### Output example
@@ -642,7 +687,10 @@ Update an existing saved query at SlicingDice. This method corresponds to a [PUT
642687
643688``` python
644689from pyslicer import SlicingDice
690+ import asyncio
691+
645692client = SlicingDice(' MASTER_API_KEY' )
693+ loop = asyncio.get_event_loop()
646694new_query = {
647695 " type" : " count/entity" ,
648696 " query" : [
@@ -660,7 +708,7 @@ new_query = {
660708 ],
661709 " cache-period" : 100
662710}
663- print (client.update_saved_query(' my-saved-query' , new_query))
711+ print (loop.run_until_complete( client.update_saved_query(' my-saved-query' , new_query) ))
664712```
665713
666714#### Output example
@@ -695,8 +743,11 @@ Executed a saved query at SlicingDice. This method corresponds to a [GET request
695743
696744``` python
697745from pyslicer import SlicingDice
746+ import asyncio
747+
698748client = SlicingDice(' MASTER_OR_READ_API_KEY' )
699- print (client.get_saved_query(' my-saved-query' ))
749+ loop = asyncio.get_event_loop()
750+ print (loop.run_until_complete(client.get_saved_query(' my-saved-query' )))
700751```
701752
702753#### Output example
@@ -732,8 +783,11 @@ Delete a saved query at SlicingDice. This method corresponds to a [DELETE reques
732783
733784``` python
734785from pyslicer import SlicingDice
786+ import asyncio
787+
735788client = SlicingDice(' MASTER_API_KEY' )
736- print (client.delete_saved_query(' my-saved-query' ))
789+ loop = asyncio.get_event_loop()
790+ print (loop.run_until_complete(client.delete_saved_query(' my-saved-query' )))
737791```
738792
739793#### Output example
@@ -767,7 +821,10 @@ Retrieve inserted values for entities matching the given query. This method corr
767821
768822``` python
769823from pyslicer import SlicingDice
824+ import asyncio
825+
770826client = SlicingDice(' MASTER_OR_READ_API_KEY' )
827+ loop = asyncio.get_event_loop()
771828query = {
772829 " query" : [
773830 {
@@ -785,7 +842,7 @@ query = {
785842 " columns" : [" car-model" , " year" ],
786843 " limit" : 2
787844}
788- print (client.result(query))
845+ print (loop.run_until_complete( client.result(query) ))
789846```
790847
791848#### Output example
@@ -815,7 +872,10 @@ Retrieve inserted values as well as their relevance for entities matching the gi
815872
816873``` python
817874from pyslicer import SlicingDice
875+ import asyncio
876+
818877client = SlicingDice(' MASTER_OR_READ_API_KEY' )
878+ loop = asyncio.get_event_loop()
819879query = {
820880 " query" : [
821881 {
@@ -833,7 +893,7 @@ query = {
833893 " columns" : [" car-model" , " year" ],
834894 " limit" : 2
835895}
836- print (client.score(query))
896+ print (loop.run_until_complete( client.score(query) ))
837897```
838898
839899#### Output example
@@ -866,9 +926,12 @@ Retrieve inserted values using a SQL syntax. This method corresponds to a POST r
866926
867927``` python
868928from pyslicer import SlicingDice
929+ import asyncio
930+
869931client = SlicingDice(' MASTER_OR_READ_API_KEY' )
932+ loop = asyncio.get_event_loop()
870933query = " SELECT COUNT(*) FROM default WHERE age BETWEEN 0 AND 49"
871- print (client.sql(query))
934+ print (loop.run_until_complete( client.sql(query) ))
872935```
873936
874937#### Output example
0 commit comments