FastAPI studio for inspecting SQLAlchemy databases
Project description
sqlalchemy-studio
Backend utilities for inspecting and serving database tables via a FastAPI Studio.
This package exposes a small FastAPI app that can be embedded in your application or run standalone to inspect a SQLAlchemy-accessible database.
Quick summary
- API endpoints (when using the packaged server):
GET /api/tables— list tables and columnsGET /api/tables/{name}— describe a single tablePOST /api/{table_name}/query— run the UI's advanced query payload
Install
pip install sqlalchemy-studio
Or install from the repository for development/testing:
pip install --upgrade git+https://github.com/coderxuz/sqlalchemy-studio.git@main#subdirectory=sqlalchemy-studio-backend
Quickstart
from sqlalchemy import create_engine
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy_studio import Studio
class Base(DeclarativeBase):
pass
engine = create_engine("sqlite:///test.db")
studio = Studio(engine, Base)
# Starts uvicorn and serves API under /api
studio.run(port=9000)
# API available at http://localhost:9000/api
Serving a built frontend (optional)
If you build the Vite frontend, copy its dist output into the backend studio/static folder
and the backend will serve the SPA from / while keeping the API under /api.
Example:
# from repository root
npm --prefix sqlalchemy-studio-front install
npm --prefix sqlalchemy-studio-front run build
rm -rf sqlalchemy-studio-backend/studio/static
mkdir -p sqlalchemy-studio-backend/studio/static
cp -r sqlalchemy-studio-front/dist/* sqlalchemy-studio-backend/studio/static/
Configuration notes
- By default the package mounts static files at
/and prefixes API routes with/apito avoid SPA route collisions. Adjuststudio/Studio.pyif you need a different layout. - CORS:
Studioregisters a small set of development origins. When serving the SPA from the same server you won't need CORS; keep/updateStudio._set_corsfor other setups.
Publishing
- Build the distribution locally:
python -m pip install --upgrade build twine
python -m build
- Upload to PyPI (CI should set
PYPI_API_TOKEN):
python -m twine upload dist/*
License MIT — update as appropriate.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlalchemy_studio-0.1.4.tar.gz.
File metadata
- Download URL: sqlalchemy_studio-0.1.4.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0546c25285b70c30e19cc5f04a9fef2a9e7b8af213d77cc67a493c58c1e424ba
|
|
| MD5 |
d130195b2fdbd3f081e5d9b33a760b2f
|
|
| BLAKE2b-256 |
43b66c25bd8b044720bcaf9442b45de6be697cc470386c34bef2b07faca2b83d
|
File details
Details for the file sqlalchemy_studio-0.1.4-py3-none-any.whl.
File metadata
- Download URL: sqlalchemy_studio-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14532dfbf3747f2868cf9a6aa8d034eb4838b91b780b3b0b20bc8bb05559e0b4
|
|
| MD5 |
b04f074395ad14547c4fcc7e4f6489ca
|
|
| BLAKE2b-256 |
1fa0057888f76fd6182bb27703e0e6c2581fe208b8a75b47063dbc9b26c1e51e
|