Timeplus API Python SDK
Timeplus Python SDK
to install the sdk, run pip install timeplus
from rx import operators as ops
from timeplus import Stream, StreamColumn, Query, Env
# initialize timeplus environment
api_key = os.environ.get("TIMEPLUS_API_KEY")
env = (
Env().schema("https").host("hostname").port("443").api_key(api_key)
)
Env.setCurrent(env)
# create a stream
s = (
Stream()
.name("stream_name")
.column(StreamColumn().name("field_name_a").type("string"))
.column(StreamColumn().name("field_name_b").type("float64"))
)
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(),
)
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.1.10.tar.gz
(282.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
timeplus-0.1.10-py3-none-any.whl
(14.5 kB
view details)
File details
Details for the file timeplus-0.1.10.tar.gz.
File metadata
- Download URL: timeplus-0.1.10.tar.gz
- Upload date:
- Size: 282.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cd7390257da4307883099cc3439bb5e856cc4a507d4b8c73b06de4082e6225b
|
|
| MD5 |
9e1a51237fb018e6e85928320c3cfa8a
|
|
| BLAKE2b-256 |
a649c2cb299ad9e4661f85355105959be4f9dc8586eafecc119cbcc1d379923b
|
File details
Details for the file timeplus-0.1.10-py3-none-any.whl.
File metadata
- Download URL: timeplus-0.1.10-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85ebb6c4058c0ba9f318ae2bd2c6f73c4f4b0cd529f826b6b9fa583354ae2def
|
|
| MD5 |
c15d0243c03a3ae615a2084a83c64b7f
|
|
| BLAKE2b-256 |
dd439f336cde7260b091806d0b6bde6e5ca65dc837c7450309f22eea2e2e00e5
|