Skip to main content

Mini pickle database

Project description


Logo

Mini-Pickle-Database-Framework

An easy way to build your very own small database!

Table of Contents
  1. About The Project
  2. Usage
  3. Contributing
  4. Contact
  5. Acknowledgments

About The Project

This framework is used to create a light, easy to use and versatile database that fits perfectly in small projects or in larger tasks requiring a small database for some sort of data management.

(back to top)

Built With

Below you can find a list of all major frameworks/libraries used to bootstrap this project:

(back to top)

Prerequisites

  • Python version 3.9 or above
  • Pickle
  • IDE (VS Code, PyCharm, Thonny etc.)

Usage

Here is how to framework actually functions:

  1. Initial steps: As a start, you must clone the repository and use the pickle_wrapper.py file to import the needed modules as shown below:
from pickle_wrapper import p_wrapper

1.1. You can initiate the database class using the:

  db = p_wrapper()

1.2. You should specify the file path of the database document as shown below:

  db.db_file = 'file_path'

Note: The Wrapper will automatically create the file, but not the folder, so one must be created manually.

  1. Document Structure:

2.1. The documents follow a simple Python dictionary format as shown below:

  example_doc = {
    'key_1': "value_1",
    "key_2": "value_2"
    }
  1. Database Usage: 2.1. How to insert a single document in the database:
single_doc = {
"key_1": "value_1",
"key_2": "value_2"
}
db.insert(single_doc)

2.2. How to insert multiple documents in the database:

multiple_docs = [
  {
      "key_1": "value_1",
      "key_2": "value_2"
  },
  {
      "key_3":  "value_3",
      "key_4":  "value_4"
  }
]
db.insert(multiple_docs)

Note: The database automatically assigns an ID to every document and is autoincremented.

  [
    {"key_1": "value_1", "key_2": "value_2", "id": 0}, 
    {"key_1": "value_1", "key_2": "value_2", "id": 1}
  ]

Note: The data type of the multiple document database is a list of dictionaries.

2.3. How to load the database:

  db.load()

Note: It returns a list of dictionaries.

2.4. How to query the database:

2.4.1. Query a single document:

  db.query_one({'key_2': 'value'})

Note: It will return only the first document it finds.

2.4.2. Query a multiple documents:

  db.query_many({'key_2': 'value'})

Note: It will return all the documents matching the querry in a list format.

2.5. How to delete document:

  db.delete_all({'key': 'value'})

Note: It will delete all the documents matching the querry in a list format. For more examples, please refer to the Documentation

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Contact

Marin Dragolov - murrou13@gmail.com

Project Link: https://github.com/murrou-cell/mini_pickle_db

(back to top)

Acknowledgments

(back to top)

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

mini-pickle-db-0.0.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

mini_pickle_db-0.0.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file mini-pickle-db-0.0.2.tar.gz.

File metadata

  • Download URL: mini-pickle-db-0.0.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.0rc2

File hashes

Hashes for mini-pickle-db-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6954e1f51057c3e174b89f598d3f5164f6b1ac6a9e526f3e413799b4ae38c6f9
MD5 444056455d174a84f8907c0b35196e69
BLAKE2b-256 d198eac51eee2f0cb4d65ed4f3b5f65a32611f6cc31d2e0f2ce49bf63ae7bfd2

See more details on using hashes here.

File details

Details for the file mini_pickle_db-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: mini_pickle_db-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.0rc2

File hashes

Hashes for mini_pickle_db-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6cde1b053a4e27e8900db5ba6c650918d063e8fd6d769cc6dc8ffee8f53b6f8b
MD5 7e46cf80ad41b1996e57137761e1c3d2
BLAKE2b-256 8a083c0186d7985c3a4b81b1a5e0ac44d125dd61be3e91352be4551f7610c3cd

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