Skip to main content

Temporal Key Value Store

Project description

TKV - Temporal Key-Value Store

A key-value store that supports timestamp-based queries, allowing you to retrieve values as they existed at specific points in time.

Features

  • Temporal queries: Get the value for a key at the largest timestamp less than or equal to your query timestamp
  • Multiple backends: SQLite as default, Redis and RocksDB as experimental alternatives
  • REST API: FastAPI-based web interface
  • CLI interface: Command-line tools for direct interaction

Project Layout

src/
├── service.py      # Core backend store implementations
├── api.py          # FastAPI web server
└── cli.py          # Command-line interface

The primary interest is service.py, which contains the main backend store implementation using SQLAlchemy/SQLite, as well as experimental alternatives using Redis and RocksDB. The CLI and API are implemented separately as distinct interfaces to the core functionality.

Installation

From PyPI (Recommended)

pip install tkv

Development with uv

First install uv:

# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Then clone and install:

git clone JackIsMyShephard/tkv.git
cd tkv
uv sync

Usage

CLI

# Store a value
tkv put mykey myvalue 1000

# Retrieve a value
tkv get mykey 1500

Web API

Start the server:

tkv-web run

Store data:

curl -X PUT http://localhost:8000/ \
  -H "Content-Type: application/json" \
  -d '{"key":"mykey","value":"myvalue","timestamp":1000}'

Retrieve data:

curl "http://localhost:8000/mykey?timestamp=1500"

Development

uv sync --group dev
uv run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tkv-0.1.0.tar.gz (564.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tkv-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file tkv-0.1.0.tar.gz.

File metadata

  • Download URL: tkv-0.1.0.tar.gz
  • Upload date:
  • Size: 564.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for tkv-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6f076d5101bb0d5f34c2d563a0973f4689b6ccfafae60f9004299b4006c83b03
MD5 49d8939a48f83c4de56b43a36abe9cca
BLAKE2b-256 afee290b7bdbe510d3ca9a50107eb831c075873345d7e0cbd3856808e3ee0e5a

See more details on using hashes here.

File details

Details for the file tkv-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tkv-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for tkv-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b2d7a74a761887dca700d3fbe6fcadcc9b461927bbaedbe49e6520a85d193e6
MD5 6185063ad1d4e12882a1067fdae0e7fc
BLAKE2b-256 046d922e6044dc8a938b28934c45b4a489ae32803df0aa7ea4b23bcbda6c038c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page