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.5.dev1.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.5.dev1-py2.py3-none-any.whl (7.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file yamldb-1.0.5.dev1.tar.gz.

File metadata

  • Download URL: yamldb-1.0.5.dev1.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.5.dev1.tar.gz
Algorithm Hash digest
SHA256 9177249e206db51bbe184c580aa3ffe02672f1d6b7391cd557630cb4a27cdf4a
MD5 ea431278e6a694e06abd9c506ad58715
BLAKE2b-256 4729fb123873eb0a5c74ac5bdcd2a2fed8f1475c709710b417527900ce4fdec3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yamldb-1.0.5.dev1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.9 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.5.dev1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1786a6189c40a6c8b2fd2c17065f93c8768cb02a261b1f8bd1eb77fef756a8a7
MD5 3f7c0de5d4d65a435ecb61b88b4dbf65
BLAKE2b-256 cee64e2385a2fe936f7d8224c0238711332236ae8749649212c61ab093345edb

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