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.5.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

graphql_sqlalchemy-0.5.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for graphql-sqlalchemy-0.5.0.tar.gz
Algorithm Hash digest
SHA256 524cb62a7f29d9cd3b4aa40b029eebd5511f524820a930e7aa3c3058f1e2515a
MD5 e7c8f731f5b416cb9561f27a4a4bc65b
BLAKE2b-256 133cec76153a09a68a67d459c33b4c0544d57b0aeaf2661f53ca7822058a7d08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphql_sqlalchemy-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 040c56e04ff98ba40297c7ae5ec351c8a65fe713ad7fb93c43658a890900f5a3
MD5 2582a60561d1078bbb9b163e6bcde807
BLAKE2b-256 8b7cb7f4533c44cb85d2cbf07ba1b21f5f7538e1c007174a7e0750a39bec461f

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