apidb
Autogenerate API based on DB structure directly from Python using ORM
Installation
Use the package manager pip to install apidb.
pip install apidb
Usage
from fastapi import FastAPI
import apidb.apidb_core as ad
import uvicorn
description = """
This is your API
"""
app = FastAPI(title="Example API",
description=description,
version="1.0.0",
)
db_api_dict={'workspaces':'read','nodes':['read','create','update','delete']}
column_names=["workspace_name"]
ad.initialize_fastapi(app, db_api_dict, column_names, mysql)
@app.get("/api/v1/custom_workspaces")
def get_workspaces():
"""
Returns all workspaces
"""
return {"workspaces": []}
def run_api():
uvicorn.run(app, host="0.0.0.0", port=8000)
if __name__=="__main__":
run_api()
Current scope
Aims: Easy generation of API in Fastapi + Flask based on structure in DB (current dialects: MySQL, PostgreSQL, SQL Server, Mongo) or on series of predefined functions
Done: Flask and FastAPI simple example
Todo: Generalization
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
Metadata
Release files for apidb 0.2.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 | |
|---|---|---|---|
| apidb-0.2.1.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| apidb-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / apidb-0.2.1.tar.gz
| Download URL | apidb-0.2.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3cbdf83df1653a78b2a546f00e8586721d3e423f484e41ea3dbfbeec2d37f09e
|
|
BLAKE2b-256 checksum How to use checksums |
f7d9f37e3046b4485ea8729b5cf7c0fab4abc28ac532649ff81604dbfd8ef0ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.12
|
Release files / apidb-0.2.1-py3-none-any.whl
| Download URL | apidb-0.2.1-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
025c2aa1fb0447701e489ce7379edcacba8efc34b0ceca165c3f28d5d496a255
|
|
BLAKE2b-256 checksum How to use checksums |
f6bd61127fcdb054d7da1b02aaba1c1e9677c6c2157cad2318847ce44e7803b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.12
|