DB Dictionary
Description :
This is a module which has been designed to make it easier to work with databases in python using a dictionary like interface.
Installation :
pip install DBDictionary
Usage MongoDB :
from DBDictionary import MongoDB_Dict
my_db_dict = MongoDB_Dict("my_db_name", "my_collection_name", "my_key_field", "my_connection_string")
# The connection string is optional and will default to
# "mongodb://localhost:27017/" if not provided here and not in the ENV var also
my_db_dict["my_key"] = {"my_key_field": "my_key",
"other data": "my_value"} # This will insert a new document into the collection
your_value = my_db_dict["my_key"] # This will return "my_value", the value in the database
print(your_value) # This will print {"my_key_field": "my_key", "other data": "my_value"}
del my_db_dict["my_key"] # This will delete the document from the collection
# now trying to retrive the value will raise a KeyError ,
# but you can use the "get" method like you do in a dictionary as usual
your_value = my_db_dict.get("my_key", "default_value") # This will return "default_value"
print(your_value) # This will print "default_value"
your_value = my_db_dict["my_key"] # This will raise a KeyError
# editing and updating a document :
your_value["other data"] = "my_new_value" # This will edit the value in the memory
my_db_dict.update(your_value) # This will update the document in the database
# When you edit a dictionary like this :
my_db_dict["my_key"][
"other data"] = "my_new_value" # This will have no effect on the database and any changes will be lost
Metadata
Release files for DBDictionary 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| DBDictionary-0.1.1.tar.gz | 5.6 kB | Without provenance | Details for DBDictionary-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| DBDictionary-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for DBDictionary-0.1.1-py3-none-any.whl |
Total release size: 12.1 kB
Release files / DBDictionary-0.1.1.tar.gz
| Download URL | DBDictionary-0.1.1.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a1ab03f40dd1e37d1760dc7c44f07a2f34c5dd98998cceb20119c20dcc7051a
|
|
BLAKE2b-256 checksum How to use checksums |
480c7c99c76bb7b0beac5d568c73983d9e48907984c8d65a60469334cd5da7fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / DBDictionary-0.1.1-py3-none-any.whl
| Download URL | DBDictionary-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04698c3fdb6f544ed69044fcd894fc5d00bf6f4920b5ab8404353ecec1f6a25a
|
|
BLAKE2b-256 checksum How to use checksums |
52507ecb725882eec348a783e9c78a6c3409f04591e3df508ef9ce8b67e60f9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Security for DBDictionary 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.