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

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.

Project details


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.4.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: yamldb-1.0.4.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for yamldb-1.0.4.tar.gz
Algorithm Hash digest
SHA256 370ec372f66d55c9240ed34ac24c9e06f891739548f939e1ae8ceba71f45eb6f
MD5 20bdfcf1ab01b1e3359b0bd4a7c0a011
BLAKE2b-256 eb8bf91c57c2d1574094f5be7e85837ae5980f910a903a948689973ca47aa06f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for yamldb-1.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b2abeb48687bb556db8f95e323151753db2fb90e1ffe9818f7448663c929d7e6
MD5 11c734449d4c8c788f02360d8a986480
BLAKE2b-256 bb12199f6c09d5ec26eff7099b45b3fb8560a71217ef71a37954a9c839f17939

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page