Skip to main content

Timeplus python SDK

Project description

Timeplus API Python SDK

Timeplus Python SDK

to install the sdk, run pip install timeplus

import os

from rx import operators as ops
from timeplus import Stream, StreamColumn, Query, Env, Type

# initialize timeplus environment
api_key = os.environ.get("TIMEPLUS_API_KEY")
env = (
    Env().schema("https").host("hostname").port("443").tenant("tenant").api_key(api_key)
)
Env.setCurrent(env)

# create a stream
s = (
    Stream()
    .name("stream_name")
    .column(StreamColumn().name("field_name_a").type(Type.String))
    .column(StreamColumn().name("field_name_b").type(Type.Float))
)

s.create()

# insert data into stream
s.insert(
    [
        [
            "hello",
            100.1
        ],
        [
            "timeplus",
            20.2
        ],
    ]
)

# delete stream
s.delete()

# run query on existing stream
query = Query().sql(f"select * from stream_name")
query.create()

query.get_result_stream().pipe(ops.take(5)).subscribe(
    on_next=lambda i: print(f"get one query result {i}"),
    on_error=lambda e: print(f"error {e}"),
    on_completed=lambda: query.stop(),
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timeplus-0.2.0.tar.gz (283.5 kB view details)

Uploaded Source

Built Distribution

timeplus-0.2.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file timeplus-0.2.0.tar.gz.

File metadata

  • Download URL: timeplus-0.2.0.tar.gz
  • Upload date:
  • Size: 283.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.7

File hashes

Hashes for timeplus-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9414f08d3a86f019fc679de761eb70003bc67d04c75d4b28ea1df4b535195859
MD5 93eae959a8be54ec0159a1ac8cfa98c7
BLAKE2b-256 79b50895953b07d59942b60732d3646063a244f2442261ff18eaa5211e020a71

See more details on using hashes here.

File details

Details for the file timeplus-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: timeplus-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.7

File hashes

Hashes for timeplus-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d3583d9c7cbe95bde642b54861629788b9c3c0bde4e73e95893b55bdccfd1b2c
MD5 2b18a2a8f797098bb183cbed68593cef
BLAKE2b-256 6efe0b6c171c5a1963ca7edc306e67e6c7fe2a6db2678e1378eb45aab27d9f43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page