Skip to main content

ORM for JSON/YAML file based DB

Project description

https://badge.fury.io/py/labml_db.svg https://pepy.tech/badge/labml_db

LabML DB

LabML DB is a simple ORM database that uses JSON and YAML files.

You can install this package using PIP.

pip install labml_db

Example

from labml_db import Model, Index


class Project(Model['Project']):
    name: str
    experiments: int

    @classmethod
    def defaults(cls):
        return dict(name='', experiments=0)


class User(Model['User']):
    name: str
    projects: List[Key[Project]]

    @classmethod
    def defaults(cls):
        return dict(name='', projects=[])


class UsernameIndex(Index['User']):
    pass

You can configure it to use JSON/YAML files

Model.set_db_drivers([
    FileDbDriver(JsonSerializer(), 'User', Path('./data/user')),
    FileDbDriver(YamlSerializer(), 'Project', Path('./data/project'))
])
Index.set_db_drivers([
    FileIndexDbDriver(YamlSerializer(), 'UsernameIndex', Path('./data/UserNameIndex.yaml'))
])

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

labml_db-0.0.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

labml_db-0.0.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file labml_db-0.0.2.tar.gz.

File metadata

  • Download URL: labml_db-0.0.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for labml_db-0.0.2.tar.gz
Algorithm Hash digest
SHA256 440bd0566389dd8d98e5e24eb6ec38fb135f54ebf9714c819fd679572ed3f47e
MD5 bedfe4cdc115d5b62a45b084eb78eab9
BLAKE2b-256 dada093417172ec9af71310df31efc7b4421d8122b5681fc8c3018e0f1082ef7

See more details on using hashes here.

File details

Details for the file labml_db-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: labml_db-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for labml_db-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f877cb1208f019a492ee8868bca4432beff218090494e2a1e99f0e95b0f9b937
MD5 ef1c026e3eb5edae49e4246b75d526ec
BLAKE2b-256 e297a385dabe5079782d5e48a9d15e1175d1ad3bda120e9678234f0a37a88c48

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