v0.6.2 · Early access

Your database.
Instant GraphQL API.

PyGraphile reads your database schema and generates a working GraphQL API — tables become types, columns become fields, and resolvers are wired up for you.

$ pip install pygraphile

Everything you need, nothing you don't

Drop in PyGraphile and get a GraphQL API with zero schema writing.

Schema introspection

Automatically reads your database tables, columns, and types. No manual mapping required.

Instant GraphQL

Generates a complete, executable GraphQL schema with types and query resolvers on the fly.

Multi-database support

Full support for SQLite, MariaDB, and MySQL today. PostgreSQL support is on the roadmap.

ASGI native

Returns a standard ASGI app you can mount into FastAPI, Starlette, or any ASGI framework.

Pure Python

Built with modern Python practices. Supports Python 3.9 through 3.13+.

Minimal setup

Three lines of code to go from a database file to a running GraphQL endpoint.

From database to API in seconds

PyGraphile handles the entire pipeline automatically.

  1. Point to your database

    Pass the path to your SQLite file, or a MariaDB/MySQL connection URI. PyGraphile connects and introspects the schema automatically.

  2. Schema is generated

    Each table becomes a GraphQL type. Column names and SQL types are mapped to GraphQL fields and scalars automatically.

  3. Resolvers are attached

    Query resolvers are dynamically created for every table — no manual resolver writing needed.

  4. Mount and serve

    Get back an ASGI-compatible GraphQL app powered by Ariadne. Mount it in FastAPI or any ASGI server and you're live.

Up and running in 3 lines

Install PyGraphile and plug it into your FastAPI app. Works with SQLite, MariaDB, and MySQL.

main.py — SQLite
from pygraphile import PyGraphile
from fastapi import FastAPI

app = FastAPI()

# Point to your SQLite database
pg = PyGraphile('mydb.sqlite', db_type='sqlite')

# Mount the GraphQL app
app.mount('/graphql', pg.get_query_app())
main.py — MariaDB / MySQL
# Install with: pip install pygraphile[mariadb]
md = PyGraphile(
  'mariadb://user:pass@127.0.0.1:3306/mydb',
  db_type='mariadb',
)
app.mount('/graphql', md.get_query_app())
Generated schema
# Table "tabapi request log" with
# id INT, full name VARCHAR

type TabapiRequestLog {
  id: Int
  full_name: String
}

type Query {
  tabapi_request_log: [TabapiRequestLog]
}
Query it
curl -X POST http://localhost:8000/graphql/ \
  -H "Content-Type: application/json" \
  -d '{"query":"{ tabapi_request_log { id full_name } }"}'

What's coming next

PyGraphile is actively developed. Here's where we're headed.

  • Project setup & structure
  • SQLite schema introspection
  • GraphQL schema generation
  • Query resolver implementation
  • MariaDB & MySQL support
  • Identifier sanitization (spaces & special chars)
  • Mutation support
  • PostgreSQL support
  • Filtering & pagination
  • Authentication & authorization
  • Plugin system

Start building today

Install PyGraphile and have your GraphQL API running in under a minute.