Generate GraphQL Schemas from your SQLAlchemy models
Project description
graphql-sqlalchemy
Generate GraphQL Schemas from your SQLAlchemy models
Install
pip install graphql-sqlalchemy
Usage
from ariadne.asgi import GraphQL
from fastapi import FastAPI
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from graphql_sqlalchemy import build_schema
engine = create_engine('sqlite:///config.db')
Base = declarative_base()
Session = sessionmaker(bind=engine)
app = FastAPI()
session = Session()
schema = build_schema(Base)
app.mount("/graphql", GraphQL(schema, context_value=dict(session=session)))
Query
query {
user(
where: {
_or: [
{ id: { _gte: 5 } },
{ name: { _like: "%bob%" } },
]
}
) {
id
name
}
user_by_pk(id: 5) {
createtime
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file graphql-sqlalchemy-0.6.1.tar.gz.
File metadata
- Download URL: graphql-sqlalchemy-0.6.1.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.7.7 Darwin/20.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
364a873a94285d136aaf0c4e8b48cc3de9f50cb45cbfa107df6e01ab28a26abc
|
|
| MD5 |
315e9ee1e3fcf79adf1f7aae0efc8c3a
|
|
| BLAKE2b-256 |
1f2ecde85d2a9fffdf4b2a88527a3887a0ab90f00ef72442871d1db186eb31f3
|
File details
Details for the file graphql_sqlalchemy-0.6.1-py3-none-any.whl.
File metadata
- Download URL: graphql_sqlalchemy-0.6.1-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.7.7 Darwin/20.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec77fa884ddc186d99eb6a8fe849acce4a3c8b4d99780553073fcf6360a3cf47
|
|
| MD5 |
3d78e067af6adf3c37bccf825c38e416
|
|
| BLAKE2b-256 |
0fe74c4a75c26c7e7ea84c0151438deee25a306b744edf9371e550702e4eefeb
|