menousdb


Namemenousdb JSON
Version 0.1.3 PyPI version JSON
download
home_page
SummaryA SDK for Menous DB
upload_time2023-06-12 11:33:39
maintainer
docs_urlNone
authorSnehashish Laskar
requires_python
license MIT License Copyright (c) 2022 Snehashish Laskar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .container{
            align-items: center;
        }
        .image{
            max-height:200px;
        }
    </style>
</head>
<body>
    <div class="container">
        <img class="image" src="../assets/logo-full.png">
    </div>
    
</body>
</html>

# Introduction
Menous DB is a simple and elegant key value database. It uses a structured file system to store key values. The database is written in python and can be used directly in python using the menousdb pip package.

# Installation
You can install the menousdb module by using the pip package manager. You can install the package manager on all platforms by using the following commands:
```
For Linux use the following commands

$ sudo apt update
$ sudo apt upgrade
$ sudo apt-get install python3-pip
```
```
For Mac OS use homebrew to install pip

$ brew install python3-pip
```

Next we will use the pip package manager to install the library. Make sure you have pip set up properly and you can access it through your terminal window.

```
(Windows)

$ pip install menousdb 

(Mac OS and Linux)

$ pip3 install menousdb
```

# Documentation
### Importing the module
To import the menousdb import simply use

```python
from menousdb import *
```

### Initializing the database
To create a database from scratch use:

```python
# Using the imported class from the import statement

db = MenousDB(
    url="http://localhost:5555/",
    key="YOUR API KEY",
    database="DATABASE"
)

# Checking if the database exists
if not db.checkDbExists():
    # If not create the database
    db.createDb()
```
### Checking if the database exists
```python
# isCreated is either True or False
isCreated = db.checkDbExists()
```
### Reading the entire database
To read the entire database we will use the readDb method. The readDb method returns a dictionary that can be converted to a dataframe. 

```python
data = db.readDb()
```

### Deleting the entire database
To delete the entire database we will use the deleteDb method.
```python
if db.checkDbExists():
    db.deleteDb()
else:
    print("Database not found")
```

### Creating a new table
To create a new table, the parameters are the name of the table and the attributes of the new table. The attributes parameter must be a list of strings.
```python
# Defining the table name and attributes
table_name = "test"
attributes = ["name", "age", "gender"]

# Creating a new table using the defined variable
db.createTable(table_name, attributes)
```

### Checking if a table exists
To check if a table exists you can use the following which will return  a boolean value of True or False.

```python
# Defining the table name
table_name = "test"
# Cheking the table exists
isCreate = db.checkTableExists(table_name)
```

### Inserting values into the database
To insert new values into the table you can use the following code. The parameter values must be a dictionary whose order of keys must exactly match the order of the attributes passed in the creation of the table.

```python
# Defining table name and values
table_name = test
values = {
    "name":"John Doe",
    "age":"15",
    "gender":"male"
}

db.insertIntoTable(
    table=table_name,
    values=values
)
```
### Selecting the entire table
To get the complete data of a table use the following code:
```python
table_name = "test"
# Getting all the data in the table
data = db.getTable(table_name)
```
### Selecting Values with conditions
To search for values with conditions you can use the following code. The parameters required are the table name and the conditions which will be a dictionary.

```python
table_name = "test"
conditions = {
    "name":"John Doe"
}

# Contains all the values where the name is John Doe
data = db.selectWhere(
    table= table_name,
    conditions=conditions
)
```

### Selecting columns
To select only specefic columns from the table you can use the following code. The parameters include the table name and a list of names of columns you want to select. 

```python
table_name = "test"
columns=["name","age"]

# contains all the column values
selectedData = db.selectColumns(table_name, columns)
```

### Selecting columns with conditions
To select columns with conditions you can use the following code. The parameters include the table name, the target columns and the conditions. conditions will be a dictionary and columns will be an array. 

```python
table_name="test"
columns=["name","age"]
conditions={"name":"John Doe"}

data = db.selectColumnsWhere(
    table_name,
    columns,
    conditions
)
```

### Updating values
To update the values in the table we need the conditions and the replacement values. The parameters are the table name, the conditions and the replacement values.

```python
table_name = "test"
conditions = {
    "name":"John Doe"
}
values = {
    "name":"William Smith"
}

# This will replace the value of every row where the 
# name is John Doe to William Smith
db.updateWhere(
    table=table_name,
    conditions=conditions,
    values=values
)
```

### Deleting values
To delete values from a table with conditions use the following code. The parameters are the table name and the conditions.

```python
table_name = "test"
conditions = {
    "name":"John Doe",
}
db.deleteWhere(
    table=table_name,
    conditions=conditions
)
```

### Deleting the entire table
To delete the entire table just use the deleteTable functions. Its only parameter is the table name.
```python
table_name="test"
db.deleteTable(table_name)
```

### Getting all the databases
To get a list of all the databases use the following code.
```python
databases = db.getDatabases()
```



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "menousdb",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Snehashish Laskar",
    "author_email": "snehashish.laskar@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/96/20/4434b8c00b6ff266f976d7ce91b49352a5e4dda81829a5fb54c3bedeba40/menousdb-0.1.3.tar.gz",
    "platform": null,
    "description": "\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Document</title>\n    <style>\n        .container{\n            align-items: center;\n        }\n        .image{\n            max-height:200px;\n        }\n    </style>\n</head>\n<body>\n    <div class=\"container\">\n        <img class=\"image\" src=\"../assets/logo-full.png\">\n    </div>\n    \n</body>\n</html>\n\n# Introduction\nMenous DB is a simple and elegant key value database. It uses a structured file system to store key values. The database is written in python and can be used directly in python using the menousdb pip package.\n\n# Installation\nYou can install the menousdb module by using the pip package manager. You can install the package manager on all platforms by using the following commands:\n```\nFor Linux use the following commands\n\n$ sudo apt update\n$ sudo apt upgrade\n$ sudo apt-get install python3-pip\n```\n```\nFor Mac OS use homebrew to install pip\n\n$ brew install python3-pip\n```\n\nNext we will use the pip package manager to install the library. Make sure you have pip set up properly and you can access it through your terminal window.\n\n```\n(Windows)\n\n$ pip install menousdb \n\n(Mac OS and Linux)\n\n$ pip3 install menousdb\n```\n\n# Documentation\n### Importing the module\nTo import the menousdb import simply use\n\n```python\nfrom menousdb import *\n```\n\n### Initializing the database\nTo create a database from scratch use:\n\n```python\n# Using the imported class from the import statement\n\ndb = MenousDB(\n    url=\"http://localhost:5555/\",\n    key=\"YOUR API KEY\",\n    database=\"DATABASE\"\n)\n\n# Checking if the database exists\nif not db.checkDbExists():\n    # If not create the database\n    db.createDb()\n```\n### Checking if the database exists\n```python\n# isCreated is either True or False\nisCreated = db.checkDbExists()\n```\n### Reading the entire database\nTo read the entire database we will use the readDb method. The readDb method returns a dictionary that can be converted to a dataframe. \n\n```python\ndata = db.readDb()\n```\n\n### Deleting the entire database\nTo delete the entire database we will use the deleteDb method.\n```python\nif db.checkDbExists():\n    db.deleteDb()\nelse:\n    print(\"Database not found\")\n```\n\n### Creating a new table\nTo create a new table, the parameters are the name of the table and the attributes of the new table. The attributes parameter must be a list of strings.\n```python\n# Defining the table name and attributes\ntable_name = \"test\"\nattributes = [\"name\", \"age\", \"gender\"]\n\n# Creating a new table using the defined variable\ndb.createTable(table_name, attributes)\n```\n\n### Checking if a table exists\nTo check if a table exists you can use the following which will return  a boolean value of True or False.\n\n```python\n# Defining the table name\ntable_name = \"test\"\n# Cheking the table exists\nisCreate = db.checkTableExists(table_name)\n```\n\n### Inserting values into the database\nTo insert new values into the table you can use the following code. The parameter values must be a dictionary whose order of keys must exactly match the order of the attributes passed in the creation of the table.\n\n```python\n# Defining table name and values\ntable_name = test\nvalues = {\n    \"name\":\"John Doe\",\n    \"age\":\"15\",\n    \"gender\":\"male\"\n}\n\ndb.insertIntoTable(\n    table=table_name,\n    values=values\n)\n```\n### Selecting the entire table\nTo get the complete data of a table use the following code:\n```python\ntable_name = \"test\"\n# Getting all the data in the table\ndata = db.getTable(table_name)\n```\n### Selecting Values with conditions\nTo search for values with conditions you can use the following code. The parameters required are the table name and the conditions which will be a dictionary.\n\n```python\ntable_name = \"test\"\nconditions = {\n    \"name\":\"John Doe\"\n}\n\n# Contains all the values where the name is John Doe\ndata = db.selectWhere(\n    table= table_name,\n    conditions=conditions\n)\n```\n\n### Selecting columns\nTo select only specefic columns from the table you can use the following code. The parameters include the table name and a list of names of columns you want to select. \n\n```python\ntable_name = \"test\"\ncolumns=[\"name\",\"age\"]\n\n# contains all the column values\nselectedData = db.selectColumns(table_name, columns)\n```\n\n### Selecting columns with conditions\nTo select columns with conditions you can use the following code. The parameters include the table name, the target columns and the conditions. conditions will be a dictionary and columns will be an array. \n\n```python\ntable_name=\"test\"\ncolumns=[\"name\",\"age\"]\nconditions={\"name\":\"John Doe\"}\n\ndata = db.selectColumnsWhere(\n    table_name,\n    columns,\n    conditions\n)\n```\n\n### Updating values\nTo update the values in the table we need the conditions and the replacement values. The parameters are the table name, the conditions and the replacement values.\n\n```python\ntable_name = \"test\"\nconditions = {\n    \"name\":\"John Doe\"\n}\nvalues = {\n    \"name\":\"William Smith\"\n}\n\n# This will replace the value of every row where the \n# name is John Doe to William Smith\ndb.updateWhere(\n    table=table_name,\n    conditions=conditions,\n    values=values\n)\n```\n\n### Deleting values\nTo delete values from a table with conditions use the following code. The parameters are the table name and the conditions.\n\n```python\ntable_name = \"test\"\nconditions = {\n    \"name\":\"John Doe\",\n}\ndb.deleteWhere(\n    table=table_name,\n    conditions=conditions\n)\n```\n\n### Deleting the entire table\nTo delete the entire table just use the deleteTable functions. Its only parameter is the table name.\n```python\ntable_name=\"test\"\ndb.deleteTable(table_name)\n```\n\n### Getting all the databases\nTo get a list of all the databases use the following code.\n```python\ndatabases = db.getDatabases()\n```\n\n\n",
    "bugtrack_url": null,
    "license": " MIT License  Copyright (c) 2022 Snehashish Laskar  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  ",
    "summary": "A SDK for Menous DB",
    "version": "0.1.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7b750cbee35ae550a5bd25efcf4313d6d9d25b87c64d6425fe103eeb542365a8",
                "md5": "7bdab7ae0d226e2ae2b397581de64135",
                "sha256": "2a0ca233e429ae13b5aec9e61fa0829eb28542682d2f407d9f360a82aeac91a4"
            },
            "downloads": -1,
            "filename": "menousdb-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7bdab7ae0d226e2ae2b397581de64135",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5118,
            "upload_time": "2023-06-12T11:33:38",
            "upload_time_iso_8601": "2023-06-12T11:33:38.257929Z",
            "url": "https://files.pythonhosted.org/packages/7b/75/0cbee35ae550a5bd25efcf4313d6d9d25b87c64d6425fe103eeb542365a8/menousdb-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "96204434b8c00b6ff266f976d7ce91b49352a5e4dda81829a5fb54c3bedeba40",
                "md5": "bf1b44386d74d64f7fbaa6ac6e1ff758",
                "sha256": "f3f8dfeff1426f3ec07906b42a12dfe853c8041cb73f3c12e1a5326c09166f74"
            },
            "downloads": -1,
            "filename": "menousdb-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "bf1b44386d74d64f7fbaa6ac6e1ff758",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5284,
            "upload_time": "2023-06-12T11:33:39",
            "upload_time_iso_8601": "2023-06-12T11:33:39.963005Z",
            "url": "https://files.pythonhosted.org/packages/96/20/4434b8c00b6ff266f976d7ce91b49352a5e4dda81829a5fb54c3bedeba40/menousdb-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-12 11:33:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "menousdb"
}
        
Elapsed time: 0.24967s