Skip to main content

sqlalchemy-studio

FastAPI studio for inspecting and querying SQLAlchemy databases.

Installation

Install from PyPI:

pip install sqlalchemy-studio

Or install the latest version from GitHub:

pip install --upgrade git+https://github.com/coderxuz/sqlalchemy-studio.git@main#subdirectory=sqlalchemy-studio-backend

Usage

Create a normal SQLAlchemy engine and declarative base, then pass them to Studio.

from sqlalchemy import Integer, String, create_engine
from sqlalchemy.orm import DeclarativeBase, Mapped, Session, mapped_column

from sqlalchemy_studio import Studio


class Base(DeclarativeBase):
    pass


class User(Base):
    __tablename__ = "users"

    id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
    username: Mapped[str] = mapped_column(String(50), nullable=False)
    email: Mapped[str] = mapped_column(String(120), nullable=False)


engine = create_engine("sqlite:///app.db")


def seed_data() -> None:
    Base.metadata.create_all(engine)

    with Session(engine) as session:
        if session.query(User).count() == 0:
            session.add_all(
                [
                    User(username="john", email="john@example.com"),
                    User(username="alice", email="alice@example.com"),
                ]
            )
            session.commit()


if __name__ == "__main__":
    seed_data()
    Studio(engine=engine, base=Base, path="/studio").run(port=7000)

Run the script:

python app.py

Open http://localhost:7000 in your browser.

Example dashboard

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlalchemy_studio-0.2.0.tar.gz (123.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlalchemy_studio-0.2.0-py3-none-any.whl (124.2 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemy_studio-0.2.0.tar.gz.

File metadata

  • Download URL: sqlalchemy_studio-0.2.0.tar.gz
  • Upload date:
  • Size: 123.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for sqlalchemy_studio-0.2.0.tar.gz
Algorithm Hash digest
SHA256 061e220316a7230477d557d489e7e7d3dff1916ec367330a522600a25c6eb66f
MD5 6fc89de2fb7650da41c46c97f452b4d4
BLAKE2b-256 8f4a199c27de5e0acf8a0bc94c96f091fb0a5d2b35b85b8499a9f4c1768acb3e

See more details on using hashes here.

File details

Details for the file sqlalchemy_studio-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_studio-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8439e399a2c7f13752217ad1df0e16b6c913fd206767412bcabcd85be28455dc
MD5 896f0c5b0d8968ebfe4090632c0367cb
BLAKE2b-256 5954f2fb3a5750c2f718fd864c5b23cc1a544b8b33c8b4848d66a4b483d9079d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page