Name | btrdb JSON |
Version |
5.33.0
JSON |
| download |
home_page | None |
Summary | Bindings to interact with the Berkeley Tree Database using gRPC. |
upload_time | 2024-06-17 22:17:27 |
maintainer | PingThingsIO |
docs_url | None |
author | PingThingsIO |
requires_python | <4,>=3.6 |
license | Copyright (c) 2017 Sam Kumar <samkumar@berkeley.edu> Copyright (c) 2017 Michael P Andersen <m.andersen@cs.berkeley.edu> Copyright (c) 2017 University of California, Berkeley All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the University of California, Berkeley nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
btrdb
berkeley
timeseries
database
bindings
grpc
|
VCS |
|
bugtrack_url |
|
requirements |
certifi
grpcio
grpcio-tools
protobuf
pytz
pyyaml
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# BTrDB Bindings for Python
These are BTrDB Bindings for Python allowing you painless and productive access to the Berkeley Tree Database (BTrDB). BTrDB is a time series database focusing on blazing speed with respect to univariate time series data at the nanosecond scale.
## Sample Code
Our goal is to make BTrDB as easy to use as possible, focusing on integration with other tools and the productivity of our users. In keeping with this we continue to add new features such as easy transformation to numpy arrays, pandas Series, etc. See the sample code below and then checkout our [documentation](https://btrdb-python.readthedocs.io/en/latest/) for more in depth instructions.
import btrdb
# connect to database
conn = btrdb.connect("192.168.1.101:4410")
# view time series streams found at provided collection path
streams = conn.streams_in_collection("USEAST_NOC1/90807")
for stream in streams:
print(stream.name)
# retrieve a given stream by UUID and print out data points. In value
# queries you will receive RawPoint instances which contain a time and value
# attribute
stream = conn.stream_from_uuid("71466a91-dcfe-42ea-9e88-87c51f847942")
for point, _ in stream.values(start, end):
print(point)
>> RawPoint(1500000000000000000, 1.0)
>> RawPoint(1500000000100000000, 2.0)
>> RawPoint(1500000000200000000, 3.0)
...
# view windowed data. Each StatPoint contains the time of the window and
# common statistical data such as min, mean, max, count, and standard
# deviation of values the window covers. See docs for more details.
width = 300000000
depth = 20
for point, _ in stream.windows(start=start, end=end,
width=width, depth=depth):
>> StatPoint(1500000000000000000, 1.0, 2.0, 3.0, 3, 0.816496580927726)
>> StatPoint(1500000000300000000, 4.0, 5.0, 6.0, 3, 0.816496580927726)
>> StatPoint(1500000000600000000, 7.0, 8.0, 9.0, 3, 0.816496580927726)
You can also easily work with a group of streams for when you need to evaluate data across multiple time series or serialize to disk.
from btrdb.utils.timez import to_nanoseconds
start = to_nanoseconds(datetime(2018,1,1,9,0,0))
streams = db.streams(*uuid_list)
# convert stream data to numpy arrays
data = streams.filter(start=start).to_array()
# serialize stream data to disk as CSV
streams.filter(start=start).to_csv("data.csv")
# convert stream data to a pandas DataFrame
streams.filter(start=start).to_dataframe()
>> time NOC_1/stream0 NOC_1/stream1
0 1500000000000000000 NaN 1.0
1 1500000000100000000 2.0 NaN
2 1500000000200000000 NaN 3.0
3 1500000000300000000 4.0 NaN
4 1500000000400000000 NaN 5.0
5 1500000000500000000 6.0 NaN
6 1500000000600000000 NaN 7.0
7 1500000000700000000 8.0 NaN
8 1500000000800000000 NaN 9.0
9 1500000000900000000 10.0 NaN
## Installation
See our documentation on [installing](https://btrdb-python.readthedocs.io/en/latest/installing.html) the bindings for more detailed instructions. However, to quickly get started using the latest available versions you can use `pip` to install from pypi with `conda` support coming in the near future.
$ pip install btrdb
## Tests
This project includes a suite of automated tests based upon [pytest](https://docs.pytest.org/en/latest/). For your convenience, a `Makefile` has been provided with a target for evaluating the test suite. Use the following command to run the tests.
$ make test
Aside from basic unit tests, the test suite is configured to use [pytest-flake8](https://github.com/tholo/pytest-flake8) for linting and style checking as well as [coverage](https://coverage.readthedocs.io) for measuring test coverage.
Note that the test suite has additional dependencies that must be installed for them to successfully run: `pip install -r tests/requirements.txt`.
## Releases
This codebase uses github actions to control the release process. To create a new release of the software, run `release.sh` with arguments for the new version as shown below. Make sure you are in the master branch when running this script.
```
./release.sh 5 11 4
```
This will tag and push the current commit and github actions will run the test suite, build the package, and push it to pypi. If any issues are encountered with the automated tests, the build will fail and you will have a tag with no corresponding release.
After a release is created, you can manually edit the release description through github.
## Documentation
The project documentation is written in reStructuredText and is built using Sphinx, which also includes the docstring documentation from the `btrdb` Python package. For your convenience, the `Makefile` includes a target for building the documentation:
$ make html
This will build the HTML documentation locally in `docs/build`, which can be viewed using `open docs/build/index.html`. Other formats (PDF, epub, etc) can be built using `docs/Makefile`. The documentation is automatically built on every GitHub release and hosted on [Read The Docs](https://btrdb-python.readthedocs.io/en/latest/).
Note that the documentation also requires Sphix and other dependencies to successfully build: `pip install -r docs/requirements.txt`.
## Versioning
This codebases uses a form of [Semantic Versioning](http://semver.org/) to structure version numbers. In general, the major version number will track with the BTrDB codebase to transparently maintain version compatibility. Planned features between major versions will increment the minor version while any special releases (bug fixes, etc.) will increment the patch number.
## Pre-commit hooks
`pip install pre-commit` and then run
`pre-commit run --all-files` to comb through changes and make sure they are formatted correctly.
`pre-commit install` and then run `git commit` to automatically run the pre-commit hooks on every commit.
Raw data
{
"_id": null,
"home_page": null,
"name": "btrdb",
"maintainer": "PingThingsIO",
"docs_url": null,
"requires_python": "<4,>=3.6",
"maintainer_email": "PingThingsIO <support@pingthings.io>",
"keywords": "btrdb, berkeley, timeseries, database, bindings, gRPC",
"author": "PingThingsIO",
"author_email": "PingThingsIO <support@pingthings.io>",
"download_url": "https://files.pythonhosted.org/packages/7b/ed/63f07a5a0a51c24274f05e3bef9a6573e500006aee80581a8dc32b2225fa/btrdb-5.33.0.tar.gz",
"platform": null,
"description": "# BTrDB Bindings for Python\n\nThese are BTrDB Bindings for Python allowing you painless and productive access to the Berkeley Tree Database (BTrDB). BTrDB is a time series database focusing on blazing speed with respect to univariate time series data at the nanosecond scale.\n\n## Sample Code\n\nOur goal is to make BTrDB as easy to use as possible, focusing on integration with other tools and the productivity of our users. In keeping with this we continue to add new features such as easy transformation to numpy arrays, pandas Series, etc. See the sample code below and then checkout our [documentation](https://btrdb-python.readthedocs.io/en/latest/) for more in depth instructions.\n\n import btrdb\n\n # connect to database\n conn = btrdb.connect(\"192.168.1.101:4410\")\n\n # view time series streams found at provided collection path\n streams = conn.streams_in_collection(\"USEAST_NOC1/90807\")\n for stream in streams:\n print(stream.name)\n\n # retrieve a given stream by UUID and print out data points. In value\n # queries you will receive RawPoint instances which contain a time and value\n # attribute\n stream = conn.stream_from_uuid(\"71466a91-dcfe-42ea-9e88-87c51f847942\")\n for point, _ in stream.values(start, end):\n print(point)\n >> RawPoint(1500000000000000000, 1.0)\n >> RawPoint(1500000000100000000, 2.0)\n >> RawPoint(1500000000200000000, 3.0)\n ...\n\n # view windowed data. Each StatPoint contains the time of the window and\n # common statistical data such as min, mean, max, count, and standard\n # deviation of values the window covers. See docs for more details.\n width = 300000000\n depth = 20\n for point, _ in stream.windows(start=start, end=end,\n width=width, depth=depth):\n >> StatPoint(1500000000000000000, 1.0, 2.0, 3.0, 3, 0.816496580927726)\n >> StatPoint(1500000000300000000, 4.0, 5.0, 6.0, 3, 0.816496580927726)\n >> StatPoint(1500000000600000000, 7.0, 8.0, 9.0, 3, 0.816496580927726)\n\nYou can also easily work with a group of streams for when you need to evaluate data across multiple time series or serialize to disk.\n\n from btrdb.utils.timez import to_nanoseconds\n\n start = to_nanoseconds(datetime(2018,1,1,9,0,0))\n streams = db.streams(*uuid_list)\n\n # convert stream data to numpy arrays\n data = streams.filter(start=start).to_array()\n\n # serialize stream data to disk as CSV\n streams.filter(start=start).to_csv(\"data.csv\")\n\n # convert stream data to a pandas DataFrame\n streams.filter(start=start).to_dataframe()\n >> time NOC_1/stream0 NOC_1/stream1\n 0 1500000000000000000 NaN 1.0\n 1 1500000000100000000 2.0 NaN\n 2 1500000000200000000 NaN 3.0\n 3 1500000000300000000 4.0 NaN\n 4 1500000000400000000 NaN 5.0\n 5 1500000000500000000 6.0 NaN\n 6 1500000000600000000 NaN 7.0\n 7 1500000000700000000 8.0 NaN\n 8 1500000000800000000 NaN 9.0\n 9 1500000000900000000 10.0 NaN\n\n## Installation\n\nSee our documentation on [installing](https://btrdb-python.readthedocs.io/en/latest/installing.html) the bindings for more detailed instructions. However, to quickly get started using the latest available versions you can use `pip` to install from pypi with `conda` support coming in the near future.\n\n $ pip install btrdb\n\n## Tests\n\nThis project includes a suite of automated tests based upon [pytest](https://docs.pytest.org/en/latest/). For your convenience, a `Makefile` has been provided with a target for evaluating the test suite. Use the following command to run the tests.\n\n $ make test\n\nAside from basic unit tests, the test suite is configured to use [pytest-flake8](https://github.com/tholo/pytest-flake8) for linting and style checking as well as [coverage](https://coverage.readthedocs.io) for measuring test coverage.\n\nNote that the test suite has additional dependencies that must be installed for them to successfully run: `pip install -r tests/requirements.txt`.\n\n## Releases\n\nThis codebase uses github actions to control the release process. To create a new release of the software, run `release.sh` with arguments for the new version as shown below. Make sure you are in the master branch when running this script.\n\n```\n./release.sh 5 11 4\n```\n\nThis will tag and push the current commit and github actions will run the test suite, build the package, and push it to pypi. If any issues are encountered with the automated tests, the build will fail and you will have a tag with no corresponding release.\n\nAfter a release is created, you can manually edit the release description through github.\n\n## Documentation\n\nThe project documentation is written in reStructuredText and is built using Sphinx, which also includes the docstring documentation from the `btrdb` Python package. For your convenience, the `Makefile` includes a target for building the documentation:\n\n $ make html\n\nThis will build the HTML documentation locally in `docs/build`, which can be viewed using `open docs/build/index.html`. Other formats (PDF, epub, etc) can be built using `docs/Makefile`. The documentation is automatically built on every GitHub release and hosted on [Read The Docs](https://btrdb-python.readthedocs.io/en/latest/).\n\nNote that the documentation also requires Sphix and other dependencies to successfully build: `pip install -r docs/requirements.txt`.\n\n## Versioning\n\nThis codebases uses a form of [Semantic Versioning](http://semver.org/) to structure version numbers. In general, the major version number will track with the BTrDB codebase to transparently maintain version compatibility. Planned features between major versions will increment the minor version while any special releases (bug fixes, etc.) will increment the patch number.\n\n## Pre-commit hooks\n\n`pip install pre-commit` and then run\n`pre-commit run --all-files` to comb through changes and make sure they are formatted correctly.\n`pre-commit install` and then run `git commit` to automatically run the pre-commit hooks on every commit.\n",
"bugtrack_url": null,
"license": "Copyright (c) 2017 Sam Kumar <samkumar@berkeley.edu> Copyright (c) 2017 Michael P Andersen <m.andersen@cs.berkeley.edu> Copyright (c) 2017 University of California, Berkeley All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the University of California, Berkeley nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
"summary": "Bindings to interact with the Berkeley Tree Database using gRPC.",
"version": "5.33.0",
"project_urls": {
"Docs": "https://btrdb-python.readthedocs.io/",
"Download": "https://github.com/PingThingsIO/btrdb-python/tarball/v5.33",
"Repository": "https://github.com/pingthingsio/btrdb-python.git"
},
"split_keywords": [
"btrdb",
" berkeley",
" timeseries",
" database",
" bindings",
" grpc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ce0bd88ab8445110b9e20921353f81e57d932303c84475f27868913a6cd76f9e",
"md5": "3099b74cce5240107317a0124640c4c5",
"sha256": "99b58d622e1728b84c14e1d331ec6bbe560138c3d72fbe46666d8136e17f4e77"
},
"downloads": -1,
"filename": "btrdb-5.33.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3099b74cce5240107317a0124640c4c5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.6",
"size": 104964,
"upload_time": "2024-06-17T22:17:20",
"upload_time_iso_8601": "2024-06-17T22:17:20.894237Z",
"url": "https://files.pythonhosted.org/packages/ce/0b/d88ab8445110b9e20921353f81e57d932303c84475f27868913a6cd76f9e/btrdb-5.33.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7bed63f07a5a0a51c24274f05e3bef9a6573e500006aee80581a8dc32b2225fa",
"md5": "f985253e4a55e83931d12a9fa75c0cd7",
"sha256": "4de372ed97075c5039f03af070c1a1dc763efa97e14c8e52cd8f333d766716ec"
},
"downloads": -1,
"filename": "btrdb-5.33.0.tar.gz",
"has_sig": false,
"md5_digest": "f985253e4a55e83931d12a9fa75c0cd7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.6",
"size": 5970404,
"upload_time": "2024-06-17T22:17:27",
"upload_time_iso_8601": "2024-06-17T22:17:27.442015Z",
"url": "https://files.pythonhosted.org/packages/7b/ed/63f07a5a0a51c24274f05e3bef9a6573e500006aee80581a8dc32b2225fa/btrdb-5.33.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-17 22:17:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PingThingsIO",
"github_project": "btrdb-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "certifi",
"specs": []
},
{
"name": "grpcio",
"specs": []
},
{
"name": "grpcio-tools",
"specs": []
},
{
"name": "protobuf",
"specs": []
},
{
"name": "pytz",
"specs": []
},
{
"name": "pyyaml",
"specs": []
}
],
"lcname": "btrdb"
}