DBNavigator


NameDBNavigator JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://github.com/SuperZombi/DBNavigator
SummaryDataBase Navigator for Flask
upload_time2024-01-16 13:36:52
maintainer
docs_urlNone
authorSuper_Zombi
requires_python>=3.6
license
keywords
VCS
bugtrack_url
requirements Flask Jinja2
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">DB Navigator</h1>
<p align="center">
    <img src="https://raw.githubusercontent.com/SuperZombi/DBNavigator/main/github/images/logo.png" width="200">
</p>
<h3 align="center">DataBase Navigator for Flask</h3>
<p align="center">
    <img src="https://shields.io/badge/version-v0.2.2-blue"></br>
    <a href="#donate"><img src="https://shields.io/badge/💲-Support_the_Project-2ea043"></a>
</p>
<p align="center">
    <img width="500px" src="https://raw.githubusercontent.com/SuperZombi/DBNavigator/main/github/images/preview.png">
</p>

<details>
<summary>More images</summary>
<p align="center">
    <img width="500px" src="https://raw.githubusercontent.com/SuperZombi/DBNavigator/main/github/images/preview_dark.png"></br>
    <img width="500px" src="https://raw.githubusercontent.com/SuperZombi/DBNavigator/main/github/images/preview_edit.png"></br>
    <img width="500px" src="https://raw.githubusercontent.com/SuperZombi/DBNavigator/main/github/images/preview_sql.png">
</p>
</details>


## Installation
```
pip install DBNavigator
```

## Usage:
```python
from flask import Flask
from db_navigator import DBNavigator

app = Flask(__name__)
DBNavigator(app, "users.db", prefix="/admin", password="1234")

### Your Flask app

app.run(debug=True)
```

### DBNavigator(`app`, `file`, `prefix=""`, `password=""`, `login_func=None`, `readonly=False`, `db_engine`)
| <!-- --> | <!-- --> |
|----------|----------|
| `app`    | Flask app |
| `file`   | Target database local file|
| `prefix`   | Route prefix |
| `password`   | Access password |
| `login_func`   | [Custom login function](#custom-login) |
| `readonly`   | Default editable |
| `db_engine`   | Default is [SQLite](#db-engine) |
<hr>

### Custom login
Must be returned `True` for access.<br>
It is recommended to save the password from the database in memory because it will be checked before each request.
```python
def custom_login(password):
	# make request to db
	if password == "custom_value":
		return True	

DBNavigator(app, "users.db", login_func=custom_login)
```
<hr>

### DB Engine

A class that should inherit from the abstract class `DataBaseInterface` and implement all its functions.
```python
from db_navigator.databases import DataBaseInterface

class YourDBEngine(DataBaseInterface):
	def __init__(self, *args):
		super().__init__(*args)
		self.__name__ = "Your DB Engine name"

```
<hr>


#### 💲Donate

<table>
  <tr>
    <td>
       <img width="18px" src="https://www.google.com/s2/favicons?domain=https://donatello.to&sz=256">
    </td>
    <td>
      <a href="https://donatello.to/super_zombi">Donatello</a>
    </td>
  </tr>
  <tr>
    <td>
       <img width="18px" src="https://www.google.com/s2/favicons?domain=https://www.donationalerts.com&sz=256">
    </td>
    <td>
      <a href="https://www.donationalerts.com/r/super_zombi">Donation Alerts</a>
    </td>
  </tr>
</table>
    
(But now it's better to email me and I'll send you the details)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/SuperZombi/DBNavigator",
    "name": "DBNavigator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Super_Zombi",
    "author_email": "super.zombi.yt@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/76/a3/8471d85f9d02bae5ec823a64cc2c432af29d32354c5a498644944fba8773/DBNavigator-0.2.2.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">DB Navigator</h1>\r\n<p align=\"center\">\r\n    <img src=\"https://raw.githubusercontent.com/SuperZombi/DBNavigator/main/github/images/logo.png\" width=\"200\">\r\n</p>\r\n<h3 align=\"center\">DataBase Navigator for Flask</h3>\r\n<p align=\"center\">\r\n    <img src=\"https://shields.io/badge/version-v0.2.2-blue\"></br>\r\n    <a href=\"#donate\"><img src=\"https://shields.io/badge/\ud83d\udcb2-Support_the_Project-2ea043\"></a>\r\n</p>\r\n<p align=\"center\">\r\n    <img width=\"500px\" src=\"https://raw.githubusercontent.com/SuperZombi/DBNavigator/main/github/images/preview.png\">\r\n</p>\r\n\r\n<details>\r\n<summary>More images</summary>\r\n<p align=\"center\">\r\n    <img width=\"500px\" src=\"https://raw.githubusercontent.com/SuperZombi/DBNavigator/main/github/images/preview_dark.png\"></br>\r\n    <img width=\"500px\" src=\"https://raw.githubusercontent.com/SuperZombi/DBNavigator/main/github/images/preview_edit.png\"></br>\r\n    <img width=\"500px\" src=\"https://raw.githubusercontent.com/SuperZombi/DBNavigator/main/github/images/preview_sql.png\">\r\n</p>\r\n</details>\r\n\r\n\r\n## Installation\r\n```\r\npip install DBNavigator\r\n```\r\n\r\n## Usage:\r\n```python\r\nfrom flask import Flask\r\nfrom db_navigator import DBNavigator\r\n\r\napp = Flask(__name__)\r\nDBNavigator(app, \"users.db\", prefix=\"/admin\", password=\"1234\")\r\n\r\n### Your Flask app\r\n\r\napp.run(debug=True)\r\n```\r\n\r\n### DBNavigator(`app`, `file`, `prefix=\"\"`, `password=\"\"`, `login_func=None`, `readonly=False`, `db_engine`)\r\n| <!-- --> | <!-- --> |\r\n|----------|----------|\r\n| `app`    | Flask app |\r\n| `file`   | Target database local file|\r\n| `prefix`   | Route prefix |\r\n| `password`   | Access password |\r\n| `login_func`   | [Custom login function](#custom-login) |\r\n| `readonly`   | Default editable |\r\n| `db_engine`   | Default is [SQLite](#db-engine) |\r\n<hr>\r\n\r\n### Custom login\r\nMust be returned `True` for access.<br>\r\nIt is recommended to save the password from the database in memory because it will be checked before each request.\r\n```python\r\ndef custom_login(password):\r\n\t# make request to db\r\n\tif password == \"custom_value\":\r\n\t\treturn True\t\r\n\r\nDBNavigator(app, \"users.db\", login_func=custom_login)\r\n```\r\n<hr>\r\n\r\n### DB Engine\r\n\r\nA class that should inherit from the abstract class `DataBaseInterface` and implement all its functions.\r\n```python\r\nfrom db_navigator.databases import DataBaseInterface\r\n\r\nclass YourDBEngine(DataBaseInterface):\r\n\tdef __init__(self, *args):\r\n\t\tsuper().__init__(*args)\r\n\t\tself.__name__ = \"Your DB Engine name\"\r\n\r\n```\r\n<hr>\r\n\r\n\r\n#### \ud83d\udcb2Donate\r\n\r\n<table>\r\n  <tr>\r\n    <td>\r\n       <img width=\"18px\" src=\"https://www.google.com/s2/favicons?domain=https://donatello.to&sz=256\">\r\n    </td>\r\n    <td>\r\n      <a href=\"https://donatello.to/super_zombi\">Donatello</a>\r\n    </td>\r\n  </tr>\r\n  <tr>\r\n    <td>\r\n       <img width=\"18px\" src=\"https://www.google.com/s2/favicons?domain=https://www.donationalerts.com&sz=256\">\r\n    </td>\r\n    <td>\r\n      <a href=\"https://www.donationalerts.com/r/super_zombi\">Donation Alerts</a>\r\n    </td>\r\n  </tr>\r\n</table>\r\n    \r\n(But now it's better to email me and I'll send you the details)\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "DataBase Navigator for Flask",
    "version": "0.2.2",
    "project_urls": {
        "Homepage": "https://github.com/SuperZombi/DBNavigator"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e796d896fc664a42ec0b0d0a87761636c4fdf9db8e3f2b4f67ca78a6b6e1fc9c",
                "md5": "092369d627667e3b60e38625a40a6863",
                "sha256": "5adc99a1edef32f0435e7336d8cb4fbee4c2f07a56cd28d19c06b48af378ac42"
            },
            "downloads": -1,
            "filename": "DBNavigator-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "092369d627667e3b60e38625a40a6863",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 579428,
            "upload_time": "2024-01-16T13:36:50",
            "upload_time_iso_8601": "2024-01-16T13:36:50.198975Z",
            "url": "https://files.pythonhosted.org/packages/e7/96/d896fc664a42ec0b0d0a87761636c4fdf9db8e3f2b4f67ca78a6b6e1fc9c/DBNavigator-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "76a38471d85f9d02bae5ec823a64cc2c432af29d32354c5a498644944fba8773",
                "md5": "c5bee54dac74dee55db2515d92057553",
                "sha256": "3bd9aee8a9a2a433781f27c1aecc78abb2e751ccdbe0657da3c036936ae64083"
            },
            "downloads": -1,
            "filename": "DBNavigator-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c5bee54dac74dee55db2515d92057553",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 578044,
            "upload_time": "2024-01-16T13:36:52",
            "upload_time_iso_8601": "2024-01-16T13:36:52.487301Z",
            "url": "https://files.pythonhosted.org/packages/76/a3/8471d85f9d02bae5ec823a64cc2c432af29d32354c5a498644944fba8773/DBNavigator-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-16 13:36:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SuperZombi",
    "github_project": "DBNavigator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "Flask",
            "specs": []
        },
        {
            "name": "Jinja2",
            "specs": []
        }
    ],
    "lcname": "dbnavigator"
}
        
Elapsed time: 0.47543s