Skip to main content

ashurbanipal-flask

A read-only database browser you mount inside your own Flask app. It connects with your app's database settings, so there are no extra credentials and nothing extra to deploy. Part of Ashurbanipal.

Requires Python 3.12+ and Flask 3.

Install

Pick the extra for your database:

uv add 'ashurbanipal-flask[postgres]'   # or: pip install 'ashurbanipal-flask[postgres]'
uv add 'ashurbanipal-flask[mysql]'      # MySQL or MariaDB
uv add ashurbanipal-flask               # SQLite needs no extra

Quick start

import os

from flask import Flask

from ashurbanipal import Config, router
from ashurbanipal.db.postgres import PgSource

app = Flask(__name__)
# your own routes

config = Config(enabled=True)
source = PgSource(dsn=os.environ["DATABASE_URL"])
app.register_blueprint(router(config, [("primary", source)]))

Run flask run and open http://localhost:5000/__ashurbanipal.

Turn it on only where you want it

enabled defaults to False. When it is off, every viewer path returns 404. Decide where to enable it, for example from an environment variable:

config = Config(enabled=os.environ.get("ASHURBANIPAL_ENABLED") == "true")

Protect it

Ashurbanipal has no login. Anyone who can reach /__ashurbanipal can read every table your app's database user can read. Put your own auth in front, and check a role, not just a login. router() returns a blueprint, so a hook on it covers only the viewer:

from flask import abort

bp = router(config, [("primary", source)])


@bp.before_request
def require_admin():
    if not is_admin():
        abort(401)


app.register_blueprint(bp)

A hook on the blueprint follows it to any mount path you choose.

MySQL, MariaDB, or SQLite

from ashurbanipal.db.mysql import MySqlSource, connect_kwargs_from_url

source = MySqlSource(**connect_kwargs_from_url(os.environ["MYSQL_URL"]))  # mysql://user:pass@host:3306/db

MySqlSource also takes pymysql.connect() keyword arguments directly, for example MySqlSource(host="localhost", user="app", password="...", database="app").

from ashurbanipal.db.sqlite import SqliteSource

source = SqliteSource(path="app.db")

SQLite needs a real file. :memory: does not work, because each request opens a new connection and sees an empty database.

Column comments and common-value stats are empty on MySQL and SQLite.

More than one database

Pass more than one source. The first one is the default, and the UI lets you switch between them:

router(
    config,
    [
        ("orders", PgSource(dsn=os.environ["ORDERS_DATABASE_URL"])),
        ("billing", PgSource(dsn=os.environ["BILLING_DATABASE_URL"])),
    ],
)

Connections

Each request opens its own database connection and closes it at the end. There is no pool. For pooling, write your own DbSource around your pool.

Configuration

from ashurbanipal import Config, Limits

config = Config(
    enabled=True,
    limits=Limits(default_page_size=50, max_page_size=100, query_timeout_secs=5),  # optional; the defaults
)

app.register_blueprint(router(config, sources, mount="/__ashurbanipal"))  # mount is optional; change the URL path

The configuration table lists every option, including instance and siblings. Those let the UI show which of your other services are reachable. Import Instance and Sibling from ashurbanipal.

See also

Metadata

Release files for ashurbanipal-flask 0.15.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ashurbanipal-flask 0.15.0
File Size Uploaded Provenance Actions
ashurbanipal_flask-0.15.0.tar.gz 115.1 kB With provenance Details for ashurbanipal_flask-0.15.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ashurbanipal-flask 0.15.0
File Interpreter ABI Platform Actions
ashurbanipal_flask-0.15.0-py3-none-any.whl Python 3 none any Details for ashurbanipal_flask-0.15.0-py3-none-any.whl

Total release size: 169.7 kB

Release files / ashurbanipal_flask-0.15.0.tar.gz

Download URL ashurbanipal_flask-0.15.0.tar.gz
Size 115.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c87a03c04be1b20886d78ce7c59e618c58cf83cd6dcd040426fee4dae1cb3b05
BLAKE2b-256 checksum
How to use checksums
f9251ed81f7d09cee86bb85cdd73dfc991f27e5b521d1eb0b0a513908c2ff3a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / ashurbanipal_flask-0.15.0-py3-none-any.whl

Download URL ashurbanipal_flask-0.15.0-py3-none-any.whl
Size 54.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
694bc88fd791a1707169734f3c3afb3165f68f3178ca22f53d5a1c52bc484a41
BLAKE2b-256 checksum
How to use checksums
00d4b8662b386e83dd8b02e73d726b5bc1a922fb70a7db6d0ea3c1b29e409ed0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for ashurbanipal-flask 0.15.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ashurbanipal_flask-0.15.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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