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.9.tar.gz (14.6 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.9-py2.py3-none-any.whl (8.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: yamldb-1.0.9.tar.gz
  • Upload date:
  • Size: 14.6 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.9.tar.gz
Algorithm Hash digest
SHA256 963a942837a32f34f8dab1558c8006cf438ef9183172c181c9238eba19a1cb52
MD5 b50b06edc601aa039ef956af082bb5e2
BLAKE2b-256 0b57a86e3d80a0688597e2e581b42b3be9ca0aae7052047073be38e3013c0b49

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yamldb-1.0.9-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.7 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.9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ebcf415ab8f0a0e4542fdbd69b9bd1b0ca3c01e3a8777d076dfdbfec76ec0eb8
MD5 4715759cb70a225e16318a85c0a1e0ba
BLAKE2b-256 55b69edcac450cf34cad4453b291779cb387b87285ecb2f2ef856a7aad6126c0

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