Skip to main content

Sliceup

PyPI PyPI - Downloads GitHub

Python client of the SliceUp API

Installing

$ pip install sliceup

Examples

Importing

from sliceup import *

Database summary

from sliceup import *

sliceup = Sliceup('demo.sliceup.co')

response = sliceup.summary()

if response:
    print(response.content)
else:
    print('An error has occurred.')

Create a table

from sliceup import *

sliceup = Sliceup('demo.sliceup.co')

response = sliceup.create({
    'name': 'orders',
    'columns': [
       {'name': 'time', 'type': 'time'},
       {'name': 'qty', 'type': 'int'},
       {'name': 'price', 'type': 'float'}
    ],
    'recreate': True
})

if response:
    print(response.content)
else:
    print('An error has occurred.')

Insert data

from sliceup import *

sliceup = Sliceup('demo.sliceup.co')

response = sliceup.insert({
    'name': 'orders', 
    'rows': [
        {'time': '00:00:00', 'qty': 2, 'price': 9.0},
        {'time': '00:30:09', 'qty': 2, 'price': 2.0},
        {'time': '01:45:01', 'qty': 4, 'price': 1.0},
        {'time': '12:10:33', 'qty': 10, 'price': 16.0},
        {'time': '16:00:09', 'qty': 4, 'price': 8.0},
        {'time': '22:00:00', 'qty': 4, 'price': 23.0},
        {'time': '22:31:49', 'qty': 4, 'price': 45.0},
        {'time': '22:59:19', 'qty': 4, 'price': 17.0},
    ]
})

if response:
    print(response.content)
else:
    print('An error has occurred.')

Query data

Check out in RunKit

Select from table

from sliceup import *

sliceup = Sliceup('demo.sliceup.co')

response = sliceup.query({
    'select': ['time', 'qty', 'price'],
    'from': 'orders'
})

if response:
    print(response.content)
else:
    print('An error has occurred.')

Visualize data

from sliceup import *

sliceup = Sliceup('demo.sliceup.co')

response = sliceup.query({
    'select': ['time', 'qty', 'price'],
    'from': 'orders'
})

if response:
    print(response.content)
else:
    print('An error has occurred.')

Query table statistics

from sliceup import *

sliceup = Sliceup('demo.sliceup.co')

response = sliceup.query({
   'select': [max('time'), min('time'), min('qty'), max('qty'), min('price'), max('price')],
   'from': 'orders'
})

if response:
    print(response.content)
else:
    print('An error has occurred.')

Slice the data into hour buckets

from sliceup import *

sliceup = Sliceup('demo.sliceup.co')

response = sliceup.query({
  'select': count('price'),
  'by': bar('time', time(1,0,0)),
  'from': 'orders'
})

if response:
    print(response.content)
else:
    print('An error has occurred.')

Slice and group the quantity by bars of 2

from sliceup import *

sliceup = Sliceup('demo.sliceup.co')

response = sliceup.query({
   'select': count('price'),
   'by': bar('qty', 2),
   'from': 'orders'
})

if response:
    print(response.content)
else:
    print('An error has occurred.')

License

Sliceup is copyright (c) 2019-present SliceUp, Inc.

Sliceup is free software, licensed under the MIT. See the LICENSE file for more details.

Release files for sliceup 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sliceup 0.2.0
File Size Uploaded
sliceup-0.2.0.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sliceup 0.2.0
File Interpreter ABI Platform
sliceup-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / sliceup-0.2.0.tar.gz

Download URL sliceup-0.2.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cf116a8f3b6bce123032d65d9bf73d398c24e269e714c51c6a9458a6d77bb4b8
BLAKE2b-256 checksum
How to use checksums
54c3821c565d8f6d59ae94b48c62726f75de832f0f86cf3c1878990f10a17479
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8

Release files / sliceup-0.2.0-py3-none-any.whl

Download URL sliceup-0.2.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
faab207aef070d914382c90aac61e6baeb3cb5c96401690f2e9bc1c1cbdfb62c
BLAKE2b-256 checksum
How to use checksums
69a93b562650dc893b1eec081308cd4d2bb2c0813d75715f16cbdde38da44c10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page