skillfed

graphene-sqlalchemy

Graphene SQLAlchemy integration

graphene-sqlalchemy v2.3.0 581.9K downloads/30d#5,905 on PyPI986
Permissive license MIT AGING released

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-sqlalchemy

uv

uv add graphene-sqlalchemy

poetry

poetry add graphene-sqlalchemy

Installing 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

Development Status :: 3 - AlphaIntended Audience :: DevelopersProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries

Tags

graphql sqlalchemy integrationgraphql schema from database modelssqlalchemy to graphqlgraphene sqlalchemygraphql api from orm modelsdatabase schema graphqlsqlalchemy graphql types
graphqlorm-integrationschema-generation

More Libraries packages