# OsomeDB 1.0.3
Make And Manage DBs in Python.
[![Downloads](https://static.pepy.tech/badge/osomedb)](https://pepy.tech/project/osomedb)
<p align="right"> <img src="https://komarev.com/ghpvc/?username=meriwn-osome-db&label=Project%20views&color=0e75b6&style=flat" alt="darkmash-org" /> </p>
## Installation
Install OsomeDB with pip
```bash
pip install OsomeDB
```
## Features
- Cross platform (i think)
- Encryption (AES)
- Compression
- PassBin
- Examples provided
## Structure and Working
### Structure of DATA :
DB - > Collections - > Docs - > DATA
### Structure of Files :
- > Folder(DB_NAME)
- > File(Collection-1)
- > File(Collection-2)
- > File(Collection-3)
- > Config.json
- > PassBin-1(Created When There is a request for saving passwords)
### Config File (json) :
- > DB_NAME
- > Date Created
- > List of collections
- > enc
Eg : {"DB_NAME":"A","CREATED":"","COLLECTIONS":["A","B","C"],"ENC":false}
### PassBin (json):
Eg : {"Id":"Guy-1","Password":"The Guy's Password"}
## Usage/Examples
```python
from OsomeDB import OsomeDB
# Create/Get DB
"""
If No DB exists in db_path a new one will be created
:param db_path: Path to the DB
"""
DB = OsomeDB("School")
```
### Note : To Enable encryption from the code,
```python
# changing the settings
DB.Settings("School").change("ENC","HERE PUT THE ENCRYTION KEY") # Turning on encryption
```
or edit the config.json file.
DB class:
```python
len(DB) # returns num of collections
DB.__sizeof__() # returns the size of the DB
DB += "NewStudents" # makes a new collection
DB -= "NewStudents" # deletes the collection
DB.collection_exists("NewStudents") # checks if a collection exists
DB.make_collection("NewStudents") # makes a collection
DB.date_created() # returns the date when the DB was created
DB.get_collection("NewStudents") # returns a Obj of class Collection
DB.remove_collection("Collection-B") # deletes the collection
DB.total_collections() # returns the number of collections
DB.total_docs() # returns the number of Docs in the DB
DB.get_db_size() # returns the size of the DB
DB.get_db_collections() # returns all collections (name)
DB.get_settings() # returns settings
DB.write_settings(new_settings) # rewrites the settings
DB.renew_db() # Renews the DB with the new config file
DB.load_collection() # returns the collection data
DB.write_collection(New_collection_data) # rewrites collection data
DB.delete_collection() # deletes a collection
DB.get_collection_size() # returns the size of a collection
```
Collection class:
```python
from OsomeDB import Collection
collection = Collection("School","Students") # path to DB , Collection name
# or
collection = DB.get_collection("Students")
len(collection) # returns the number of Docs in the Collection
new_collection = collection+{"rollno.":1,"student":"Merwin"} # adds a doc
new_collection = collection-{"rollno.":1,"student":"Merwin"} # removes a doc
collection+={"rollno.":1,"student":"Merwin"} # adds a doc and saves
collection-={"rollno.":1,"student":"Merwin"} # removes a doc and saves
collection.delete() # deletes the collection
collection.__sizeof__() # returns the size of the collection
collection.read_collection_data() # returns the collection data
collection.rewrite_collection_data() # rewrites the collection data
collection.get_indexof({"User":user,"Id":Id etc...}) # returns the index of the data
collection.get_byindex(1) # gets a doc by index
# returns (index , Doc)
collection.search_by_key_val(key_name="Username",username) # Search using the value of a given key
collection.rewrite_doc(index=2,new_data={"User":user,"Id":Id etc...}) # rewrites a doc
```
PassBin class:
```python
# If passbin was not found a new one will be created
passbin = DB.PassBin("School","passwords") # param path to DB and PassBins name.
passbin.passbin_exists("passwords-staff") # checks if a passbin exists.
passbin.get_pass_bin() # returns the data in passbin
passbin.write_pass_bin(new_pass_bin_data) # rewrites the passbin
len(passbin) # the number of passwords
new_passbin = passbin+{"Id":Id,"Password":"passs"} # adds
new_passbin = passbin-{"Id":Id,"Password":"passs"} # removes
passbin = passbin+={"Id":Id,"Password":"passs"} # adds the pass and save to passbin returns passbin obj
passbin = passbin-={"Id":Id,"Password":"passs"} # removes the pass and save to passbin returns passbin obj
```
### Note : The format to + , - , += , -= In PassBin
```
{"Id":"","Password":""}
```
```python
passbin.delete_bin() # deletes the passbin
passbin.get_passbin_size() # returns the size of the passbin
passbin.__sizeof__() # returns the size of the passbin
passbin.append_new_pass(Id="1",Password="Cooldudescave123") # Appends a new password
passbin.remove(Id="1") # removes a password from passbin
passbin.reset_pass(Id="2",Password="Newcoolpassword") # resets a password
passbin.search_by_Id(Id="2") # search using the Id
```
Settings class:
```python
# Arg The path of the DB
settings = DB.Settings("School")
settings.change(key="ENC",value=True) # changes settings
settings.give_setting_info() # returns all keys available
settings.get(key="ENC") # returns value of ENC
settings.get_settings() # returns the settings
settings.write_settings(new_settings) # rewrites the settings
```
## License
[MIT](https://choosealicense.com/licenses/mit/)
## Authors
- [@Merwin](https://www.github.com/mastercodermerwin)
Raw data
{
"_id": null,
"home_page": "https://github.com/mastercodermerwin/OSOME-DB",
"name": "OsomeDB",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Cactochan",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/78/86/3a2e21764f9697c9a7690422ab1aa85f631482ae6ba3ba5d24ae926138cb/OsomeDB-5.0.4.tar.gz",
"platform": null,
"description": "\n# OsomeDB 1.0.3\n\nMake And Manage DBs in Python.\n\n[![Downloads](https://static.pepy.tech/badge/osomedb)](https://pepy.tech/project/osomedb)\n\n<p align=\"right\"> <img src=\"https://komarev.com/ghpvc/?username=meriwn-osome-db&label=Project%20views&color=0e75b6&style=flat\" alt=\"darkmash-org\" /> </p>\n\n\n\n## Installation\n\nInstall OsomeDB with pip\n\n```bash\n pip install OsomeDB\n```\n \n## Features\n\n- Cross platform (i think)\n- Encryption (AES)\n- Compression\n- PassBin\n- Examples provided\n\n## Structure and Working\n\n### Structure of DATA :\n \n DB - > Collections - > Docs - > DATA\n\n### Structure of Files :\n - > Folder(DB_NAME)\n - > File(Collection-1)\n - > File(Collection-2)\n - > File(Collection-3)\n - > Config.json\n - > PassBin-1(Created When There is a request for saving passwords)\n### Config File (json) :\n - > DB_NAME\n - > Date Created\n - > List of collections\n - > enc\n Eg : {\"DB_NAME\":\"A\",\"CREATED\":\"\",\"COLLECTIONS\":[\"A\",\"B\",\"C\"],\"ENC\":false}\n### PassBin (json):\n Eg : {\"Id\":\"Guy-1\",\"Password\":\"The Guy's Password\"}\n\n\n\n## Usage/Examples\n\n```python\nfrom OsomeDB import OsomeDB\n# Create/Get DB\n\"\"\"\n If No DB exists in db_path a new one will be created\n :param db_path: Path to the DB\n\"\"\"\nDB = OsomeDB(\"School\") \n```\n\n### Note : To Enable encryption from the code,\n```python\n# changing the settings\nDB.Settings(\"School\").change(\"ENC\",\"HERE PUT THE ENCRYTION KEY\") # Turning on encryption\n```\nor edit the config.json file.\n\n\nDB class:\n```python\n len(DB) # returns num of collections\n DB.__sizeof__() # returns the size of the DB\n DB += \"NewStudents\" # makes a new collection\n DB -= \"NewStudents\" # deletes the collection\n DB.collection_exists(\"NewStudents\") # checks if a collection exists\n DB.make_collection(\"NewStudents\") # makes a collection\n DB.date_created() # returns the date when the DB was created\n DB.get_collection(\"NewStudents\") # returns a Obj of class Collection\n DB.remove_collection(\"Collection-B\") # deletes the collection\n DB.total_collections() # returns the number of collections\n DB.total_docs() # returns the number of Docs in the DB\n DB.get_db_size() # returns the size of the DB\n DB.get_db_collections() # returns all collections (name)\n DB.get_settings() # returns settings\n DB.write_settings(new_settings) # rewrites the settings\n DB.renew_db() # Renews the DB with the new config file\n DB.load_collection() # returns the collection data\n DB.write_collection(New_collection_data) # rewrites collection data\n DB.delete_collection() # deletes a collection\n DB.get_collection_size() # returns the size of a collection\n```\n\nCollection class:\n```python\n from OsomeDB import Collection\n collection = Collection(\"School\",\"Students\") # path to DB , Collection name\n # or\n collection = DB.get_collection(\"Students\")\n len(collection) # returns the number of Docs in the Collection\n new_collection = collection+{\"rollno.\":1,\"student\":\"Merwin\"} # adds a doc\n new_collection = collection-{\"rollno.\":1,\"student\":\"Merwin\"} # removes a doc\n collection+={\"rollno.\":1,\"student\":\"Merwin\"} # adds a doc and saves\n collection-={\"rollno.\":1,\"student\":\"Merwin\"} # removes a doc and saves\n collection.delete() # deletes the collection\n collection.__sizeof__() # returns the size of the collection\n collection.read_collection_data() # returns the collection data\n collection.rewrite_collection_data() # rewrites the collection data\n collection.get_indexof({\"User\":user,\"Id\":Id etc...}) # returns the index of the data\n collection.get_byindex(1) # gets a doc by index\n # returns (index , Doc) \n collection.search_by_key_val(key_name=\"Username\",username) # Search using the value of a given key \n collection.rewrite_doc(index=2,new_data={\"User\":user,\"Id\":Id etc...}) # rewrites a doc\n\n```\n\nPassBin class:\n```python\n # If passbin was not found a new one will be created\n passbin = DB.PassBin(\"School\",\"passwords\") # param path to DB and PassBins name.\n passbin.passbin_exists(\"passwords-staff\") # checks if a passbin exists.\n passbin.get_pass_bin() # returns the data in passbin\n passbin.write_pass_bin(new_pass_bin_data) # rewrites the passbin\n len(passbin) # the number of passwords\n new_passbin = passbin+{\"Id\":Id,\"Password\":\"passs\"} # adds\n new_passbin = passbin-{\"Id\":Id,\"Password\":\"passs\"} # removes\n passbin = passbin+={\"Id\":Id,\"Password\":\"passs\"} # adds the pass and save to passbin returns passbin obj\n passbin = passbin-={\"Id\":Id,\"Password\":\"passs\"} # removes the pass and save to passbin returns passbin obj\n```\n### Note : The format to + , - , += , -= In PassBin\n```\n{\"Id\":\"\",\"Password\":\"\"}\n```\n```python\n passbin.delete_bin() # deletes the passbin\n passbin.get_passbin_size() # returns the size of the passbin\n passbin.__sizeof__() # returns the size of the passbin\n passbin.append_new_pass(Id=\"1\",Password=\"Cooldudescave123\") # Appends a new password\n passbin.remove(Id=\"1\") # removes a password from passbin\n passbin.reset_pass(Id=\"2\",Password=\"Newcoolpassword\") # resets a password\n passbin.search_by_Id(Id=\"2\") # search using the Id \n```\n\nSettings class:\n```python\n # Arg The path of the DB\n settings = DB.Settings(\"School\") \n settings.change(key=\"ENC\",value=True) # changes settings\n settings.give_setting_info() # returns all keys available\n settings.get(key=\"ENC\") # returns value of ENC\n settings.get_settings() # returns the settings\n settings.write_settings(new_settings) # rewrites the settings\n```\n\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n\n## Authors\n\n- [@Merwin](https://www.github.com/mastercodermerwin)\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "A Module For Managing and Creating DBs.",
"version": "5.0.4",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "78863a2e21764f9697c9a7690422ab1aa85f631482ae6ba3ba5d24ae926138cb",
"md5": "bc8956adbcfcf032c0596654c5b74ed8",
"sha256": "09c720a138bba6965c3fa4326c4d0845f532d2225b170f26c8c6c845590c69e8"
},
"downloads": -1,
"filename": "OsomeDB-5.0.4.tar.gz",
"has_sig": false,
"md5_digest": "bc8956adbcfcf032c0596654c5b74ed8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9461,
"upload_time": "2023-01-23T12:06:20",
"upload_time_iso_8601": "2023-01-23T12:06:20.480817Z",
"url": "https://files.pythonhosted.org/packages/78/86/3a2e21764f9697c9a7690422ab1aa85f631482ae6ba3ba5d24ae926138cb/OsomeDB-5.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-23 12:06:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "mastercodermerwin",
"github_project": "OSOME-DB",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "osomedb"
}