@@ -34,9 +34,11 @@ If this is the first register ever entered into the system,
34
34
35
35
``` python
36
36
from pyslicer import SlicingDice
37
+ import asyncio
37
38
38
39
# Configure the client
39
40
client = SlicingDice(master_key = ' API_KEY' )
41
+ loop = asyncio.get_event_loop()
40
42
41
43
# Inserting data
42
44
insert_data = {
@@ -45,7 +47,7 @@ insert_data = {
45
47
},
46
48
" auto-create" : [" dimension" , " column" ]
47
49
}
48
- client.insert(insert_data)
50
+ loop.run_until_complete( client.insert(insert_data) )
49
51
50
52
# Querying data
51
53
query_data = {
@@ -61,7 +63,7 @@ query_data = {
61
63
}
62
64
]
63
65
}
64
- print (client.count_entity(query_data))
66
+ print (loop.run_until_complete( client.count_entity(query_data) ))
65
67
```
66
68
67
69
## Reference
@@ -89,8 +91,10 @@ Get information about current database(related to api keys informed on construct
89
91
90
92
``` python
91
93
from pyslicer import SlicingDice
94
+ import asyncio
92
95
client = SlicingDice(' MASTER_API_KEY' )
93
- print (client.get_database())
96
+ loop = asyncio.get_event_loop()
97
+ print (loop.run_until_complete(client.get_database()))
94
98
```
95
99
96
100
#### Output example
@@ -115,8 +119,12 @@ Get all created columns, both active and inactive ones. This method corresponds
115
119
116
120
``` python
117
121
from pyslicer import SlicingDice
122
+ import asyncio
123
+
118
124
client = 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()))
120
128
```
121
129
122
130
#### Output example
@@ -154,15 +162,19 @@ Create a new column. This method corresponds to a [POST request at /column](http
154
162
155
163
``` python
156
164
from pyslicer import SlicingDice
165
+ import asyncio
166
+
157
167
client = SlicingDice(' MASTER_API_KEY' )
168
+ loop = asyncio.get_event_loop()
169
+
158
170
column = {
159
171
" name" : " Year" ,
160
172
" api-name" : " year" ,
161
173
" type" : " integer" ,
162
174
" description" : " Year of manufacturing" ,
163
175
" storage" : " latest-value"
164
176
}
165
- print (client.create_column(column))
177
+ print (loop.run_until_complete( client.create_column(column) ))
166
178
```
167
179
168
180
#### Output example
@@ -181,7 +193,11 @@ Insert data to existing entities or create new entities, if necessary. This meth
181
193
182
194
``` python
183
195
from pyslicer import SlicingDice
196
+ import asyncio
197
+
184
198
client = SlicingDice(' MASTER_OR_WRITE_API_KEY' )
199
+ loop = asyncio.get_event_loop()
200
+
185
201
insert_data = {
186
202
" user1@slicingdice.com" : {
187
203
" car-model" : " Ford Ka" ,
@@ -217,7 +233,7 @@ insert_data = {
217
233
},
218
234
" auto-create" : [" dimension" , " column" ]
219
235
}
220
- print (client.insert(insert_data))
236
+ print (loop.run_until_complete( client.insert(insert_data) ))
221
237
```
222
238
223
239
#### Output example
@@ -238,13 +254,17 @@ Verify which entities exist in a dimension (uses `default` dimension if not prov
238
254
239
255
``` python
240
256
from pyslicer import SlicingDice
257
+ import asyncio
258
+
241
259
client = SlicingDice(' MASTER_OR_READ_API_KEY' )
260
+ loop = asyncio.get_event_loop()
261
+
242
262
ids = [
243
263
" user1@slicingdice.com" ,
244
264
" user2@slicingdice.com" ,
245
265
" user3@slicingdice.com"
246
266
]
247
- print (client.exists_entity(ids))
267
+ print (loop.run_until_complete( client.exists_entity(ids) ))
248
268
```
249
269
250
270
#### Output example
@@ -270,9 +290,11 @@ Count the number of inserted entities in the whole database. This method corresp
270
290
271
291
``` python
272
292
from pyslicer import SlicingDice
293
+ import asyncio
273
294
client = SlicingDice(' MASTER_OR_READ_API_KEY' )
295
+ loop = asyncio.get_event_loop()
274
296
275
- print (client.count_entity_total())
297
+ print (loop.run_until_complete( client.count_entity_total() ))
276
298
```
277
299
278
300
#### Output example
@@ -294,11 +316,14 @@ Count the total number of inserted entities in the given dimensions. This method
294
316
295
317
``` python
296
318
from pyslicer import SlicingDice
319
+ import asyncio
320
+
297
321
client = SlicingDice(' MASTER_OR_READ_API_KEY' )
322
+ loop = asyncio.get_event_loop()
298
323
299
324
dimensions = [' default' ]
300
325
301
- print (client.count_entity_total(dimensions))
326
+ print (loop.run_until_complete( client.count_entity_total(dimensions) ))
302
327
```
303
328
304
329
#### Output example
@@ -320,7 +345,11 @@ Count the number of entities matching the given query. This method corresponds t
320
345
321
346
``` python
322
347
from pyslicer import SlicingDice
348
+ import asyncio
349
+
323
350
client = SlicingDice(' MASTER_OR_READ_API_KEY' )
351
+ loop = asyncio.get_event_loop()
352
+
324
353
query = [
325
354
{
326
355
" query-name" : " corolla-or-fit" ,
@@ -351,7 +380,7 @@ query = [
351
380
" bypass-cache" : False
352
381
}
353
382
]
354
- print (client.count_entity(query))
383
+ print (loop.run_until_complete( client.count_entity(query) ))
355
384
```
356
385
357
386
#### Output example
@@ -374,7 +403,11 @@ Count the number of occurrences for time-series events matching the given query.
374
403
375
404
``` python
376
405
from pyslicer import SlicingDice
406
+ import asyncio
407
+
377
408
client = SlicingDice(' MASTER_OR_READ_API_KEY' )
409
+ loop = asyncio.get_event_loop()
410
+
378
411
query = [
379
412
{
380
413
" query-name" : " test-drives-in-ny" ,
@@ -407,7 +440,7 @@ query = [
407
440
" bypass-cache" : True
408
441
}
409
442
]
410
- print (client.count_event(query))
443
+ print (loop.run_until_complete( client.count_event(query) ))
411
444
```
412
445
413
446
#### Output example
@@ -430,7 +463,10 @@ Return the top values for entities matching the given query. This method corresp
430
463
431
464
``` python
432
465
from pyslicer import SlicingDice
466
+ import asyncio
467
+
433
468
client = SlicingDice(' MASTER_OR_READ_API_KEY' )
469
+ loop = asyncio.get_event_loop()
434
470
query = {
435
471
" car-year" : {
436
472
" year" : 2
@@ -439,7 +475,7 @@ query = {
439
475
" car-model" : 3
440
476
}
441
477
}
442
- print (client.top_values(query))
478
+ print (loop.run_until_complete( client.top_values(query) ))
443
479
```
444
480
445
481
#### Output example
@@ -488,7 +524,10 @@ Return the aggregation of all columns in the given query. This method correspond
488
524
489
525
``` python
490
526
from pyslicer import SlicingDice
527
+ import asyncio
528
+
491
529
client = SlicingDice(' MASTER_OR_READ_API_KEY' )
530
+ loop = asyncio.get_event_loop()
492
531
query = {
493
532
" query" : [
494
533
{
@@ -500,7 +539,7 @@ query = {
500
539
}
501
540
]
502
541
}
503
- print (client.aggregation(query))
542
+ print (loop.run_until_complete( client.aggregation(query) ))
504
543
```
505
544
506
545
#### Output example
@@ -537,8 +576,11 @@ Get all saved queries. This method corresponds to a [GET request at /query/saved
537
576
538
577
``` python
539
578
from pyslicer import SlicingDice
579
+ import asyncio
580
+
540
581
client = 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()))
542
584
```
543
585
544
586
#### Output example
@@ -588,7 +630,10 @@ Create a saved query at SlicingDice. This method corresponds to a [POST request
588
630
589
631
``` python
590
632
from pyslicer import SlicingDice
633
+ import asyncio
634
+
591
635
client = SlicingDice(' MASTER_API_KEY' )
636
+ loop = asyncio.get_event_loop()
592
637
query = {
593
638
" name" : " my-saved-query" ,
594
639
" type" : " count/entity" ,
@@ -607,7 +652,7 @@ query = {
607
652
],
608
653
" cache-period" : 100
609
654
}
610
- print (client.create_saved_query(query))
655
+ print (loop.run_until_complete( client.create_saved_query(query) ))
611
656
```
612
657
613
658
#### Output example
@@ -642,7 +687,10 @@ Update an existing saved query at SlicingDice. This method corresponds to a [PUT
642
687
643
688
``` python
644
689
from pyslicer import SlicingDice
690
+ import asyncio
691
+
645
692
client = SlicingDice(' MASTER_API_KEY' )
693
+ loop = asyncio.get_event_loop()
646
694
new_query = {
647
695
" type" : " count/entity" ,
648
696
" query" : [
@@ -660,7 +708,7 @@ new_query = {
660
708
],
661
709
" cache-period" : 100
662
710
}
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) ))
664
712
```
665
713
666
714
#### Output example
@@ -695,8 +743,11 @@ Executed a saved query at SlicingDice. This method corresponds to a [GET request
695
743
696
744
``` python
697
745
from pyslicer import SlicingDice
746
+ import asyncio
747
+
698
748
client = 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' )))
700
751
```
701
752
702
753
#### Output example
@@ -732,8 +783,11 @@ Delete a saved query at SlicingDice. This method corresponds to a [DELETE reques
732
783
733
784
``` python
734
785
from pyslicer import SlicingDice
786
+ import asyncio
787
+
735
788
client = 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' )))
737
791
```
738
792
739
793
#### Output example
@@ -767,7 +821,10 @@ Retrieve inserted values for entities matching the given query. This method corr
767
821
768
822
``` python
769
823
from pyslicer import SlicingDice
824
+ import asyncio
825
+
770
826
client = SlicingDice(' MASTER_OR_READ_API_KEY' )
827
+ loop = asyncio.get_event_loop()
771
828
query = {
772
829
" query" : [
773
830
{
@@ -785,7 +842,7 @@ query = {
785
842
" columns" : [" car-model" , " year" ],
786
843
" limit" : 2
787
844
}
788
- print (client.result(query))
845
+ print (loop.run_until_complete( client.result(query) ))
789
846
```
790
847
791
848
#### Output example
@@ -815,7 +872,10 @@ Retrieve inserted values as well as their relevance for entities matching the gi
815
872
816
873
``` python
817
874
from pyslicer import SlicingDice
875
+ import asyncio
876
+
818
877
client = SlicingDice(' MASTER_OR_READ_API_KEY' )
878
+ loop = asyncio.get_event_loop()
819
879
query = {
820
880
" query" : [
821
881
{
@@ -833,7 +893,7 @@ query = {
833
893
" columns" : [" car-model" , " year" ],
834
894
" limit" : 2
835
895
}
836
- print (client.score(query))
896
+ print (loop.run_until_complete( client.score(query) ))
837
897
```
838
898
839
899
#### Output example
@@ -866,9 +926,12 @@ Retrieve inserted values using a SQL syntax. This method corresponds to a POST r
866
926
867
927
``` python
868
928
from pyslicer import SlicingDice
929
+ import asyncio
930
+
869
931
client = SlicingDice(' MASTER_OR_READ_API_KEY' )
932
+ loop = asyncio.get_event_loop()
870
933
query = " SELECT COUNT(*) FROM default WHERE age BETWEEN 0 AND 49"
871
- print (client.sql(query))
934
+ print (loop.run_until_complete( client.sql(query) ))
872
935
```
873
936
874
937
#### Output example
0 commit comments