graphene-sqlalchemy
Graphene SQLAlchemy integration
What it is and what it does
Graphene-SQLAlchemy bridges SQLAlchemy ORM models and GraphQL by providing a `SQLAlchemyObjectType` class that automatically converts your database schema into GraphQL types. You define a model class, wrap it with the integration, and immediately get a queryable GraphQL schema without writing resolver boilerplate.
The package handles the translation layer between SQL queries and GraphQL resolution, letting you use SQLAlchemy's query API within your resolvers. It depends on graphene (the core GraphQL library), SQLAlchemy, and several utility libraries (promise, six, singledispatch) to manage async patterns and Python 2/3 compatibility. The classifiers indicate Python 2.7 and 3.5–3.7 support, though the aging maintenance status means compatibility with newer Python versions is uncertain.
Use it for:
- Rapidly prototype a GraphQL API from an existing SQLAlchemy-based application without rewriting model definitions.
- Expose database entities as GraphQL types in a Flask or Django project that already uses SQLAlchemy.
- Build a GraphQL layer on top of a legacy relational database schema managed by SQLAlchemy.
- Implement Relay-style pagination and filtering on GraphQL queries backed by SQLAlchemy ORM queries.
- Combine multiple SQLAlchemy models into a single unified GraphQL schema for a data aggregation service.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Graphene-SQLAlchemy exposes SQLAlchemy database models as GraphQL object types, letting you build GraphQL schemas directly from your existing database layer.
Yes, if your project is already using SQLAlchemy and graphene and you need a straightforward way to expose models as GraphQL types. The low install friction and permissive license make it a practical choice. However, be cautious: the package has not been updated since June 2020, so verify that its dependencies (especially graphene and SQLAlchemy) remain compatible with your target versions before committing to it in a new project. No known security vulnerabilities.
Install
graphene-sqlalchemy on PyPI
pip
pip install graphene-sqlalchemyuv
uv add graphene-sqlalchemypoetry
poetry add graphene-sqlalchemyInstalling graphene-sqlalchemy
Before you install
Low install friction with a pure-Python wheel. The package is aging (last release June 2020, no updates in over 5 years) but the repository remains active with recent commits; maintenance status suggests it is stable but not under active development.
License in practice
MIT license is permissive; you can use this package in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install "graphene-sqlalchemy>=2.0"
from graphene_sqlalchemy import SQLAlchemyObjectType
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
import graphene
Base = declarative_base()
class UserModel(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
name = Column(String)
class User(SQLAlchemyObjectType):
class Meta:
model = UserModel
class Query(graphene.ObjectType):
users = graphene.List(User)
def resolve_users(self, info):
return User.get_query(info).all()
schema = graphene.Schema(query=Query)
Requires graphene and SQLAlchemy to be installed; you must pass a SQLAlchemy session via context_value when executing queries.
Verify before relying
- Whether the package remains compatible with current versions of graphene, SQLAlchemy, and modern Python releases beyond those listed in classifiers.
- Current state of the dependency chain (graphene, promise, six, singledispatch) and whether they are still maintained.
- Whether the aging status and lack of recent releases indicate unresolved bugs or compatibility issues with newer frameworks.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — graphene, promise, SQLAlchemy, six, singledispatch |
| Maintenance | aging — 2,262 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 581,893/month — #5,905 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: graphene_sqlalchemy-2.3.0-py2.py3-none-any.whl
Keywords: api, graphql, protocol, rest, relay, graphene
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
grapheneGraphene is a Python library for building…
permissive · top 1,000 on PyPI
graphene-pydanticConverts Pydantic models into GraphQL object…
permissive · top 15,000 on PyPI
graphene-djangoGraphene-Django bridges Django models and…
permissive · top 5,000 on PyPI
graphene-django-optimizerAutomatically optimizes GraphQL queries…
permissive · top 15,000 on PyPI
graphene-federationAdds Apollo Federation support to Graphene…
permissive · top 15,000 on PyPI
marshmallow-sqlalchemyGenerates marshmallow schemas from SQLAlchemy…
permissive · top 5,000 on PyPI
sqlacodegenReads an existing database schema and generates…
permissive · top 5,000 on PyPI
graphene-file-uploadAdds file upload support to GraphQL mutations…
permissive · top 15,000 on PyPI
SQLAlchemySQLAlchemy is a Python SQL toolkit and Object…
permissive · top 100 on PyPI
GeoAlchemy2GeoAlchemy2 extends SQLAlchemy to work with…
permissive · top 5,000 on PyPI