%global _empty_manifest_terminate_build 0 Name: python-graphene-sqlalchemy-auto Version: 1.5.0 Release: 1 Summary: generate default graphene schema from sqlalchemy model base on graphene-sqlalchemy License: MIT License URL: https://github.com/goodking-bq/graphene-sqlalchemy-auto.git Source0: https://mirrors.aliyun.com/pypi/web/packages/7b/a4/1c321307d4595e8ee47e64c8a500bdf645363c443eecfe23a632d0cdc68e/graphene-sqlalchemy-auto-1.5.0.tar.gz BuildArch: noarch %description ![publish](https://github.com/goodking-bq/graphene-sqlalchemy-auto/workflows/Upload%20Python%20Package/badge.svg) generate default graphene schema from sqlalchemy model base on [graphene-sqlalchemy](https://github.com/graphql-python/graphene-sqlalchemy.git) # Installation just run ```shell script pip install graphene_sqlalchemy_auto ``` # Features - auto add `offset` `limit` `totalCount` to pagination - auto add `dbId` for model's database id - mutation auto return ok for success,message for more information and output for model data # How To Use example : ```python 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 ```gql query{ userList(filters:{name: "a"}){ edges{ node{ name id dbId } } } } ``` OR support more expr ```gql query{ userList(filters:[{key: "name",op: "==", val: "a"}]){ edges{ node{ name id dbId } } } } ``` ## op supports: - *==* - *!=* - *>=* - *<=* - *>* - *<* - *starts* - *ends* - *contains* - *in* - *notin* - *any* # Mutation example ```gql 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](https://github.com/goodking-bq/graphene-sqlalchemy-auto/tree/master/example) %package -n python3-graphene-sqlalchemy-auto Summary: generate default graphene schema from sqlalchemy model base on graphene-sqlalchemy Provides: python-graphene-sqlalchemy-auto BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-graphene-sqlalchemy-auto ![publish](https://github.com/goodking-bq/graphene-sqlalchemy-auto/workflows/Upload%20Python%20Package/badge.svg) generate default graphene schema from sqlalchemy model base on [graphene-sqlalchemy](https://github.com/graphql-python/graphene-sqlalchemy.git) # Installation just run ```shell script pip install graphene_sqlalchemy_auto ``` # Features - auto add `offset` `limit` `totalCount` to pagination - auto add `dbId` for model's database id - mutation auto return ok for success,message for more information and output for model data # How To Use example : ```python 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 ```gql query{ userList(filters:{name: "a"}){ edges{ node{ name id dbId } } } } ``` OR support more expr ```gql query{ userList(filters:[{key: "name",op: "==", val: "a"}]){ edges{ node{ name id dbId } } } } ``` ## op supports: - *==* - *!=* - *>=* - *<=* - *>* - *<* - *starts* - *ends* - *contains* - *in* - *notin* - *any* # Mutation example ```gql 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](https://github.com/goodking-bq/graphene-sqlalchemy-auto/tree/master/example) %package help Summary: Development documents and examples for graphene-sqlalchemy-auto Provides: python3-graphene-sqlalchemy-auto-doc %description help ![publish](https://github.com/goodking-bq/graphene-sqlalchemy-auto/workflows/Upload%20Python%20Package/badge.svg) generate default graphene schema from sqlalchemy model base on [graphene-sqlalchemy](https://github.com/graphql-python/graphene-sqlalchemy.git) # Installation just run ```shell script pip install graphene_sqlalchemy_auto ``` # Features - auto add `offset` `limit` `totalCount` to pagination - auto add `dbId` for model's database id - mutation auto return ok for success,message for more information and output for model data # How To Use example : ```python 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 ```gql query{ userList(filters:{name: "a"}){ edges{ node{ name id dbId } } } } ``` OR support more expr ```gql query{ userList(filters:[{key: "name",op: "==", val: "a"}]){ edges{ node{ name id dbId } } } } ``` ## op supports: - *==* - *!=* - *>=* - *<=* - *>* - *<* - *starts* - *ends* - *contains* - *in* - *notin* - *any* # Mutation example ```gql 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](https://github.com/goodking-bq/graphene-sqlalchemy-auto/tree/master/example) %prep %autosetup -n graphene-sqlalchemy-auto-1.5.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-graphene-sqlalchemy-auto -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Jun 20 2023 Python_Bot - 1.5.0-1 - Package Spec generated