Skip to main content

A file based database using yaml as file format

Project description

YamlDB

GitHub Repo image image License

General badge GitHub issues Contributors General badge

Linux macOS Windows

YamlDB is an easy to use file-based database using YAML as the format for the data represented in the file. This makes it possible to quickly change and add values in the file itself while it can then be loaded and used as a dict in your application.

It has the ability to use a dot notations for the keys instead of nested brackets. It also creates parents if they do not exist.

Note: you must be using python 3.8 or newer

pip install yamldb

from yamldb import YamlDB

db = YamlDB(filename="data.yml")

db["a"] = "1"
db["b.c"] = "2"

d = db.get("a.b.c.d", default=3)

db.load()
  reloads the file
  
db.delete("b.c")
    deletes the key b.c
    to save the state you have to also call db.save()
    
db.save()
  saves the current db into the file

db.search("a.*.c")
   quries the db
   see: https://jmespath.org/tutorial.html
   

Development and tests

The best way to contribute is with issues and pull requests. You will need to check out the development version such as

git clone https://github.com/cloudmesh/yamldb.git
cd yamldb
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -e .

Then you can run the a test with

pytest -v --capture=no tests/test_config.py

Alternatives

Acknowledgments

Continued work was in part funded by the NSF CyberTraining: CIC: CyberTraining for Students and Technologies from Generation Z with the award numbers 1829704 and 2200409.

Download files

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

Source Distribution

yamldb-1.0.7.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

yamldb-1.0.7-py2.py3-none-any.whl (7.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file yamldb-1.0.7.tar.gz.

File metadata

  • Download URL: yamldb-1.0.7.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for yamldb-1.0.7.tar.gz
Algorithm Hash digest
SHA256 f656d3e2d8f30d9abe81979059940f6d70f1aff135d5c7d8defa0dd524d0b812
MD5 d44d471b3f98856deb0de95b71811953
BLAKE2b-256 589c475fe424a5402c5e71d81347ebfbcc0a52b13b69390efa96eff5cf9800ad

See more details on using hashes here.

File details

Details for the file yamldb-1.0.7-py2.py3-none-any.whl.

File metadata

  • Download URL: yamldb-1.0.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for yamldb-1.0.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e48a3c56e583592ccaea685e82f0c446db11a4aa489bfb2da2ab3cdd09fe47ac
MD5 bf1405d3992fbffc14d4c8acc36836a3
BLAKE2b-256 eaa0b6adc4c74493cd671cbe9240e96381d7b5286eb58910a956ef6d5bce704c

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