Skip to main content

tslite

A Simple Time Series Database Implemented By Python.

Install

 pip install tslite

Usage

# -*- coding: UTF-8 -*
'''
Created on 2020-02-19
'''
from __future__ import print_function
import random, time

import tslite

path = '/tmp/tsdb/test'  # the database path
db = tslite.Database(path)
tabname = 't1'
db.drop_table(tabname)  # clern table

# get table
tab = db.get_table(tabname)

# define the table struct
tab.define({
    'field_lock': True,  # lock the table struct
    'fields': [
        {'name': 'name', 'type': 'string', 'index': True},
        {'name': 'group', 'type': 'int', 'index': True},
        {'name': 'x', 'type': 'int', 'index': True},

        {'name': 'v', 'type': 'int'},
        {'name': 'y', 'type': 'float'},
        {'name': 'z', 'type': 'float'},
        {'name': 't', 'type': 'float'},
    ]
})

# count for testing
count = 10
tm = time.time()
for i in range(count):
    # write data
    tab.write_data({'x': i, 'time': tm + i, 'name': random.choice(['a', 'aa', 'bb']), 'y': random.random()})

# query data
q = tab.query()
for r in q:
    print(r)

print('name is "a":')
# query field 'name' == "a"
q = tab.query(eqs={'name': 'a'})
for r in q:
    print(r)

Click to view more information!

CHANGES

1.0.0

  • first version

Metadata

Release files for tslite 1.0.4

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

Source distribution (sdist)

Source distribution for tslite 1.0.4
File Size Uploaded
tslite-1.0.4.tar.gz 5.4 kB Details

Release files / tslite-1.0.4.tar.gz

Download URL tslite-1.0.4.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0dc3953ef5e2f4427ac95dc5530514d20290546afac319df836f33201304e6c5
BLAKE2b-256 checksum
How to use checksums
675f40dcf41a6a03f6418f411b1e3eb2a949def77dabf0124943c6bc04c38bd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.16

Release history Release notifications | RSS feed

This release

1.0.4 This release

1 release file

1.0.2

1 release file

1.0.0

1 release file

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