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

Uploaded Source

Built Distribution

graphql_sqlalchemy-0.5.2-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: graphql-sqlalchemy-0.5.2.tar.gz
  • Upload date:
  • Size: 8.2 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.5.2.tar.gz
Algorithm Hash digest
SHA256 2341228da3a23e320e41fb899492b94d27b7ff9a760bbc17429b9d3a7acc9799
MD5 fdb1c07a15d282005ebab72bb1789c9d
BLAKE2b-256 48f91b3a1554c8725f6fbcfa6ac1e7adaa3c1885a180253b2b63f78b327aa768

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphql_sqlalchemy-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 237041d81178e7bbc5be5cef778474ce3b35639e29a1d3993bfb45a1f89cbaaf
MD5 b2fe1e33b103a5e7aa554bf80ca20124
BLAKE2b-256 2f6c788df77d52961c60338972a153b36897684f5e2c1ba2c09fbf82dbfd1711

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