Welcome to btrdb docs!

https://img.shields.io/travis/BTrDB/btrdb-python/master.svg https://readthedocs.org/projects/btrdb/badge/?version=latest https://img.shields.io/pypi/pyversions/btrdb.svg https://img.shields.io/badge/License-BSD%203--Clause-blue.svg


Starting with the 5.0 release, btrdb-python will be Python 3 only! This decision was not made lightly but is necessary to keep compatibility with underlying packages.

In addition, this software is only compatible with version 5.x of the BTrDB server. To communicate with a 4.x server, please install an earlier version of this software.

Welcome to btrdb-python’s documentation. We provide Python access to the Berkeley Tree Database (BTrBD) along with some select convenience methods. If you are familiar with other NoSQL libraries such as pymongo then you will likely feel right at home using this library.

BTrDB is a very, very fast timeseries database. Specifically, it is a time partitioned, version annotated, clustered solution for high density univariate data. It’s also incredibly easy to use. Checkout out our Installing page to get setup and then visit Quick Start for a brief tour. Some sample code is below to whet your appetite.

import btrdb
from btrdb.utils.timez import to_nanoseconds

# establish connection to server
conn = btrdb.connect("")

# search for streams and view metadata
streams = conn.streams_in_collection("USEAST_NOC1/90807")
for stream in streams:
    print(stream.collection, stream.name, stream.tags())

# retrieve a single stream
stream = conn.stream_from_uuid("07d28a44-4991-492d-b9c5-2d8cec5aa6d4")

# print one hour of time series data starting at 1/1/2018 12:30:00 UTC
start = to_nanoseconds(datetime(2018,1,1,12,30))
end = start + (60 * 60 * 1e9)
for point, _ in stream.values(start, end):
    print(point.time, point.value)

If you don’t have access to a BTrDB server, then please see our smartgridstore docs and repo to get a Dockerized version up and running quickly.

Indices and tables