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.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: labml_db-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a6167a97013b88199113c6d974b5a6bcd31ad6b86c65dc60074b9f8b65e24af8
MD5 aea01411eb45dda9b49368bccb4c2eb1
BLAKE2b-256 37fba3f4ed06927823cdfa1831de6dac022b28574aa391ae5b6a91c825dc0b30

See more details on using hashes here.

File details

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

File metadata

  • Download URL: labml_db-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 67b6977c86a8c58f5b2301e684dfde755e3f5609d718dabe0cace6a4e76de4fa
MD5 0bd7915bb920586acd404f4544065355
BLAKE2b-256 451522b87d60b3bcd2a7188b871f5064ad4103718459e1214fe213fbed921dcc

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