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.
Features
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 & WSGI
Returns a standard ASGI or WSGI app. Mount into FastAPI or Starlette, or serve with Gunicorn — your choice.
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.
How it works
From database to API in seconds
PyGraphile handles the entire pipeline automatically.
-
Point to your database
Pass the path to your SQLite file, or a MariaDB/MySQL connection URI. PyGraphile connects and introspects the schema automatically.
-
Schema is generated
Each table becomes a GraphQL type. Column names and SQL types are mapped to GraphQL fields and scalars automatically.
-
Resolvers are attached
Query resolvers are dynamically created for every table — no manual resolver writing needed.
-
Mount and serve
Get back an ASGI or WSGI GraphQL app powered by Ariadne. Mount it in FastAPI for ASGI, or serve it with Gunicorn for WSGI — you're live either way.
Quick start
Up and running in 3 lines
Install PyGraphile and plug it into your app. Works with SQLite, MariaDB, and MySQL — via ASGI or WSGI.
from pygraphile import PyGraphile from fastapi import FastAPI app = FastAPI() # Point to your SQLite database pg = PyGraphile('mydb.sqlite', db_type='sqlite') # Mount the ASGI GraphQL app app.mount('/graphql', pg.get_asgi_app())
# pip install "pygraphile[mariadb]" gunicorn from pygraphile import PyGraphile pg = PyGraphile( 'mariadb://user:pass@127.0.0.1:3306/mydb', db_type='mariadb', ) # Expose as a WSGI app application = pg.get_wsgi_app() # gunicorn app:application
# 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_asgi_app())
# Table "tabapi request log" with # id INT, full name VARCHAR type TabapiRequestLog { id: Int full_name: String } type Query { tabapi_request_log: [TabapiRequestLog] }
curl -X POST http://localhost:8000/graphql/ \ -H "Content-Type: application/json" \ -d '{"query":"{ tabapi_request_log { id full_name } }"}'
Roadmap
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)
-
WSGI support (
get_wsgi_app()) - 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.