Skip to main content

Generate GraphQL Schemas from your SQLAlchemy models

Project description

graphql-sqlalchemy

PyPI version Build Status codecov Code Style

Generate GraphQL Schemas from your SQLAlchemy models

Install

pip install graphql-sqlalchemy

Usage

from ariadne.asgi import GraphQL
from fastapi import FastAPI
from graphql_sqlalchemy import build_schema

from .session import Session
from .base import Base


app = FastAPI()
session = Session()

schema = build_schema(Base)

app.mount("/graphql", GraphQL(schema, context_value=dict(session=session)))

Query

query MyQuery {
    user(
        where: {
            _or: [
                { id: { _gte: 5 } },
                { name: { _like: "%bob%" } },
            ]
        }
    ) {
        id
        name
    }
    model_by_pk(id: 5) {
        createtime
    }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphql-sqlalchemy-0.6.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

graphql_sqlalchemy-0.6.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file graphql-sqlalchemy-0.6.0.tar.gz.

File metadata

  • Download URL: graphql-sqlalchemy-0.6.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.6.7 Linux/4.15.0-1028-gcp

File hashes

Hashes for graphql-sqlalchemy-0.6.0.tar.gz
Algorithm Hash digest
SHA256 3e64cf0b7cfbab32fd1986eba36d2f423fef3e38ad65bdbecfdb99140ca4c423
MD5 68d457076ce88f3f4dae4e76de4a6871
BLAKE2b-256 24b19821736d3928f290ab5333777551fee2511b816d76298e6b3fbb453002d6

See more details on using hashes here.

File details

Details for the file graphql_sqlalchemy-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for graphql_sqlalchemy-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6e86bf3941191f662016e5247da161b368f393dbd79aacd902f121d06e2737a
MD5 77eb8f5d8b60af31e20531a1e7bca0ff
BLAKE2b-256 c27a5ff41c24a7857eb5b424c6ef1f61936359e4fe02436ae1659380d40af06f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page