BootstrAPI
Automatically generate an OpenAPI for your existing database.
Features
- Generates an API for your current database
- Generates OpenAPI docs
- Supports OData-like queries ($select, $filter, $expand)
- Support all RESTful HTTP methods (GET, POST, PUT, PATCH, DELETE)
- Supports all Databases supported by SQLAlchemy
Requirements
Python
- Python 3.6+
Database
- Exactly one primary key per table
Quickstart
There are 3 main ways to run the code. As a standalone Python app, as a package and a Docker container.
Python App
First clone the code into a folder, then run:
$ pip install -r requirements.txt
$ python -m run connection_string [--title "API"] [--host 0.0.0.0] [--port 8000] [--schema dbo]
Python Package
Install the bootstrapi package
$ pip install bootstrapi
Then create an FastAPI app and register the routes.
import uvicorn
from fastapi.applications import FastAPI
from sqlalchemy import create_engine
from sqlalchemy.ext.automap import automap_base
from bootstrapi.router import BootstrAPIRouter
connection_string = "" #Your SQLAlchemy Connection string here
engine = create_engine(connection_string)
app = FastAPI(title='My API')
Base = automap_base()
Base.prepare(engine,schema = schema)
router = BootstrAPIRouter(engine,Base)
app.include_router(router)
uvicorn.run(app, host='127.0.0.1', port=8000)
Docker
$ docker run --env connection="YOUR_CONNECTION_STRING" -p 8000:8000 mrpowerus/bootstrapi
Metadata
Release files for bootstrapi 0.1.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 | |
|---|---|---|---|
| bootstrapi-0.1.1.tar.gz | 20.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bootstrapi-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.5 kB
Release files / bootstrapi-0.1.1.tar.gz
| Download URL | bootstrapi-0.1.1.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c352cebe8771729112e9b29bf48a48e34a512e32da6b43b7a55575b67681c07
|
|
BLAKE2b-256 checksum How to use checksums |
8643b468624c0691dda6681f2c5d5e1ef92c6b17f3be4b9e539f5fa2eac37024
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
|
Release files / bootstrapi-0.1.1-py3-none-any.whl
| Download URL | bootstrapi-0.1.1-py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7686e8d30b39834e72ed8b45e6c3872cbbd572848e8c1c13f0ecac4cb29daac9
|
|
BLAKE2b-256 checksum How to use checksums |
6b7d7d975996b0d47c4e66b34102cd7ff02686842690143d89ec58d8b3680aea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
|