Package lakota
Lakota
Lakota is a columnar storage solution for timeseries.
Lakota organises reads and writes through a changelog inspired by Git. This changelog provides: historisation, concurrency control and ease of synchronisation across different storage backends.
Quickstart
Install with pip install lakota
You can then run:
from lakota import Repo, Schema
ts_schema = Schema(timestamp="timestamp*", value="float")
repo = Repo("my-data-folder") # or Repo("s3://my-s3-bucket")
clct = repo.create_collection(ts_schema, "temperature")
series = clct.series('Brussels')
df = {
"timestamp": [
"2020-01-01T00:00",
"2020-01-02T00:00",
"2020-01-03T00:00",
"2020-01-04T00:00",
],
"value": [1, 2, 3, 4],
}
series.write(df)
df = series[:'2020-01-03'].df()
print(df)
# ->
# timestamp value
# 0 2020-01-01 1.0
# 1 2020-01-02 2.0
# 2 2020-01-03 3.0
See lakota.repo
and lakota.schema
on how to create a repository
and define collections.
See lakota.collection
and lakota.series
on how to create series
and read/write data.
lakota.commit
and lakota.changelog
document how data is organised
into files and directories.
Expand source code
"""
# Lakota
Lakota is a columnar storage solution for timeseries.
Lakota organises reads and writes through a changelog inspired by
Git. This changelog provides: historisation, concurrency control and
ease of synchronisation across different storage backends.
## Quickstart
Install with `pip install lakota`
You can then run:
``` python
from lakota import Repo, Schema
ts_schema = Schema(timestamp="timestamp*", value="float")
repo = Repo("my-data-folder") # or Repo("s3://my-s3-bucket")
clct = repo.create_collection(ts_schema, "temperature")
series = clct.series('Brussels')
df = {
"timestamp": [
"2020-01-01T00:00",
"2020-01-02T00:00",
"2020-01-03T00:00",
"2020-01-04T00:00",
],
"value": [1, 2, 3, 4],
}
series.write(df)
df = series[:'2020-01-03'].df()
print(df)
# ->
# timestamp value
# 0 2020-01-01 1.0
# 1 2020-01-02 2.0
# 2 2020-01-03 3.0
```
See `lakota.repo` and `lakota.schema` on how to create a repository
and define collections.
See `lakota.collection` and `lakota.series` on how to create series
and read/write data.
`lakota.commit` and `lakota.changelog` document how data is organised
into files and directories.
"""
from .changelog import *
from .collection import *
from .frame import *
from .pod import *
from .repo import *
from .schema import *
from .series import *
__version__ = "0.7.1"
Sub-modules
lakota.batch
lakota.changelog
lakota.cli
-
Example usage …
lakota.collection
-
Read and Writes Series …
lakota.commit
-
The
Commit
class is responsible to structure the content of a commit file. A commit is like a sorted dataframe with the following columns:label
, … lakota.frame
lakota.http_pod
lakota.pod
-
The
POD
class implement low-level access to different storage. Thefrom_uri
method allow to instanciate a POD object based on a uri. The supported … lakota.repo
-
The
Repo
class manage the organisation of a storage location. It provides creation and deletion of collections, synchronization with remote … lakota.s3_pod
lakota.schema
lakota.series
lakota.server
-
The server sub-module implement a flask application that expose The main methods of
POD
. It can be launched from the cli like this: … lakota.sexpr
-
The
AST
(abstract syntax tree) implement parsing and evaluation of s-expressions … lakota.utils