Skip to main content

Simple KV Storage and memoization based on sqlite

Project description

SQL Pickle

SQL Pickle is a simple key-value store that uses SQLite to store pickled objects.

from sqlpickle import KeyValueStore
store = KeyValueStore('test.db')

store['test'] = 1
print(store['test']) 
# 1

store['very_complex_object'] = {'a': 1, 'b': 2}

Memoization

from sqlpickle import memoize, KeyValueStore

@memoize(KeyValueStore('test.db'))
def expensive_function(x):
    return x**2

expensive_function(2) # 4
expensive_function(2) # 4

Other features

'key' in store # True
store.keys() # ['key1', 'key2']
store.items() # [('key1', 1), ('key2', 2)]
store.get('key1') # 1
store.get('key2') # 2
store.get('key3') # KeyError
len(store) # 2
store.random_keys(2) # ['key1', 'key2']

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

sqlpickle-0.1.3.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

sqlpickle-0.1.3-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file sqlpickle-0.1.3.tar.gz.

File metadata

  • Download URL: sqlpickle-0.1.3.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/23.6.0

File hashes

Hashes for sqlpickle-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9e745ed4213b6993a4e0da9327fe6d904745b66f4cbddce7ebf132e22a7b1629
MD5 d9de805dd73090ddb5caaf7cf6a8892a
BLAKE2b-256 d5e683478579e06acbad88e863b4bc22f4a3a90096723941544f022b0594c7c4

See more details on using hashes here.

File details

Details for the file sqlpickle-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: sqlpickle-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/23.6.0

File hashes

Hashes for sqlpickle-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c3cea6e4ddb8eb5641d6453f5c936db090ac6ebc4b57a6e3110acee34ebadd66
MD5 18849e180a7e017fd43a2a1263f833cb
BLAKE2b-256 f3743b0f68d7a46405c9aee50473e5345d3887bc7fe37fe992c7ebd25c188ff0

See more details on using hashes here.

Supported by

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