graphene-sqlalchemy
graphene-sqlalchemy copied to clipboard
Add SQLAlchemyList and SQLAlchemy mutations types
This brings default support for fields filtering and ordering on queries and mutations.
This is a work in progress for comments, please do not merge for now.
Coverage decreased (-14.4%) to 76.389% when pulling a8f6718a11539c389b18a1e3ba1a1a625b758868 on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage decreased (-14.4%) to 76.389% when pulling a8f6718a11539c389b18a1e3ba1a1a625b758868 on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage decreased (-14.4%) to 76.389% when pulling a8f6718a11539c389b18a1e3ba1a1a625b758868 on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage decreased (-14.4%) to 76.389% when pulling 694588821417498b4e24e7c92deb2871c0aefe12 on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage decreased (-14.4%) to 76.389% when pulling 694588821417498b4e24e7c92deb2871c0aefe12 on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage decreased (-14.4%) to 76.389% when pulling ffc4d71eab8ac37a2d799428d7d4dcf4fd8a3d38 on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage decreased (-14.4%) to 76.389% when pulling ffc4d71eab8ac37a2d799428d7d4dcf4fd8a3d38 on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage decreased (-14.4%) to 76.389% when pulling ffc4d71eab8ac37a2d799428d7d4dcf4fd8a3d38 on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage decreased (-14.5%) to 76.334% when pulling 365a0ec256dd6ea46d9a4e5d24c7880ebf5a1ab1 on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage decreased (-4.7%) to 86.079% when pulling 596a72b6668c92efc8814290c1272a5bd35ea7ea on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage increased (+0.1%) to 90.951% when pulling ae30f003e53b031111e5831f3b2ce5511dc7560a on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage increased (+0.9%) to 91.667% when pulling 9936191ffda484aaa0829fa33c0080a3bf8d41af on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage increased (+0.8%) to 91.579% when pulling f89fa117a1552a2914876a9cfaacf831a6c7bb7b on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage increased (+1.2%) to 92.008% when pulling 894517dac26eb2b39319d6bceeabaa478dcba61c on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
Coverage increased (+1.2%) to 91.992% when pulling 919bbd60db50bd9ea76d379b7ded6d84df7e1eb4 on Toilal:filtering-and-relationships into ecd9a91815ec795cd1275725a7bd7d79259e9e1a on graphql-python:master.
There's only an update_all
mutation missing I think now. Could you review this pull request ? Maybe it requires some documentation update too ?
+1 Looking forward to this in a release so I can remove my copy-pasta of this diff in my own codebase.
+1 yeah this looks really useful
Cool jobs!
----update---- A little question with the code as follows
class Tags(SQLAlchemyObjectType):
class Meta:
model = models.Tags # a SQLAlchemy model that contains two columns (id,name)
interfaces = (graphene.relay.Node, )
class UpdateTags(SQLAlchemyUpdate):
class Meta:
model = models.Tags
Output = Tags
class Query(graphene.ObjectType):
tags = SQLAlchemyConnectionField(Tags)
class Mutation(graphene.ObjectType):
update_tags = UpdateTags.Field()
schema = graphene.Schema(query=Query, mutation=Mutation)
I get a tag with result {"id":"VGFnczox","name":"test"}
, but the follows mutation won't success.
mutation{
update_tags(id:"VGFnczox",name:"test2"){
id
name
}
}
I track the excution and find that SQLAlchemyUpdate's mutate will accept id as VGFnczox instead of translate it to an integer, which causes UpdateTags failed. So far, my testing has been limited to the GraphiQL console, so am I missing something?
@Toilal re: relationships I've left some comments on https://github.com/graphql-python/graphene-sqlalchemy/issues/29 on how I've been handling them.
I've actually abandonned trying to implement a GraphQL service with Python :(.
(switched back to REST and Spring/Kotlin)
Bump, I'd love to see this implemented in graphene-sqlalchemy. Thanks @Toilal for your contribution on this.
I can confirm that this works beautifully, and is precisely what I needed. How soon can this be merged?
Hey, can this be merged, after resolving the conflict?
@Toilal Would it be possible to resolve the conflict also if possible would be great to update the README or the documentation with usage/example or some blurb about this feature, @syrusakbary Any idea who the maintainer of this repo is and if they can review and merge this PR ?
Great feature. How soon can the PR be merged?!
This would be very useful for us too - currently looking into how we generate mutates straight from SQLAlchemy model. Looks like this would do it 😀 .
Any word from the authors about when this would be merged?
I would take a look on this PR soon, sorry for the delay.
@syrusakbary note that there's been quite a bit of improvements to these classes on #29, the latest versions are available as gists in that issue