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

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: yamldb-1.0.5.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.tar.gz
Algorithm Hash digest
SHA256 ca9f096d1ce6616a3fd23fd14f99f3ceb935aa4d1f396035f0b7c514c0fb71ca
MD5 dc9115d209739cddb6985fe882c410f8
BLAKE2b-256 99364bd5e6a824c38a35c07a6e3d6a4c8dca2a983ffa82e86f0f5a79a8227d40

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yamldb-1.0.5-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.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b732119368d0a4278fd330fa663a173923100f1753863fe7296fb3c92e4f7491
MD5 8c8350de18b4c30a62ce4c96396e3e2c
BLAKE2b-256 5109d69417b7b7aa5fb1d45f4abaccd927660b4a1b14f41c44a23a3dc7408524

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