https://github.com/superzombi/dbnavigator
Database navigator for Flask
https://github.com/superzombi/dbnavigator
database-gui flask-extension sqlite3
Last synced: about 1 year ago
JSON representation
Database navigator for Flask
- Host: GitHub
- URL: https://github.com/superzombi/dbnavigator
- Owner: SuperZombi
- Created: 2023-11-14T20:59:11.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-18T16:01:33.000Z (about 2 years ago)
- Last Synced: 2025-04-12T01:17:15.922Z (about 1 year ago)
- Topics: database-gui, flask-extension, sqlite3
- Language: Python
- Homepage:
- Size: 1.49 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
DB Navigator
DataBase Navigator for Flask
More images
## 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) |
### Custom login
Must be returned `True` for access.
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)
```
### 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"
```
#### đŸ’²Donate