ORM for JSON/YAML file based DB
Project description
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
Release history Release notifications | RSS feed
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 hashes)