generate default graphene schema from sqlalchemy model base on graphene-sqlalchemy
Installation
just run
pip install graphene_sqlalchemy_auto
Features
- auto add
offsetlimittotalCountto pagination - auto add
dbIdfor model's database id - mutation auto return ok for success,message for more information and output for model data
How To Use
example :
from graphene_sqlalchemy_auto import QueryObjectType,MutationObjectType
from sqlalchemy.ext.declarative import declarative_base
import graphene
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
Session = sessionmaker()
class Query(QueryObjectType):
class Meta:
declarative_base = Base
exclude_models = ["User"] # exclude models
class Mutation(MutationObjectType):
class Meta:
declarative_base = Base
session=Session() # mutate used
include_object = []# you can use yourself mutation UserCreateMutation, UserUpdateMutation
schema = graphene.Schema(query=Query, mutation=Mutation)
Query example
just equal
query{
userList(filters:{name: "a"}){
edges{
node{
name
id
dbId
}
}
}
}
OR support more expr
query{
userList(filters:[{key: "name",op: "==", val: "a"}]){
edges{
node{
name
id
dbId
}
}
}
}
op supports:
- ==
- !=
- >=
- <=
- >
- <
- starts
- ends
- contains
- in
- notin
- any
Mutation example
createUser(input:{name: "cc",password: "dd"}){
ok
output{
id
dbId
name
}
message
}
about Schema names
- model.class.name.lower : query a data by id
- model.class.name.decapitalize[first lower]+"List": query list
- create|update|delete+model.class.name : mutation data
about many-to-many mutation
now you can use schema everywhere.some like flask,fastapi
also more example you can find in example
Metadata
Release files for graphene-sqlalchemy-auto 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| graphene-sqlalchemy-auto-1.5.0.tar.gz | 9.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| graphene_sqlalchemy_auto-1.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.3 kB
Release files / graphene-sqlalchemy-auto-1.5.0.tar.gz
| Download URL | graphene-sqlalchemy-auto-1.5.0.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2edfcb26a30ffbda822971cac6fa33c4b9da0ac28f55355a113f8cdd2044eace
|
|
BLAKE2b-256 checksum How to use checksums |
7ba41c321307d4595e8ee47e64c8a500bdf645363c443eecfe23a632d0cdc68e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|
Release files / graphene_sqlalchemy_auto-1.5.0-py3-none-any.whl
| Download URL | graphene_sqlalchemy_auto-1.5.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
466abd44c8ec30d73c121f1abf972a3451d4bd621c71455581b890739a77ed9d
|
|
BLAKE2b-256 checksum How to use checksums |
bef51569007feec6610c349d2c35478e5ba42742cdf96234839b1ecdc3a60092
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|
Security for graphene-sqlalchemy-auto 1.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.