association_proxy support by dpep · Pull Request #267 · graphql-python/graphene-sqlalchemy
Generally like the change as it probably saves a lot of code. One thing we have to be cautious about is that when variables are proxied they might be proxied between nodes. This will eventually conflict with the caching relay and apollo do internally. Imagine the following classes:
class A: id = str() b = relationship(B) proxied_c = association_proxy(B.c) class B: id = str() c = str()
If we now run the mutation:
query = """mutation alterB($c: str!) {
alterB(c: $c) {
id
c
}
}"""
the cache for B is update to contain the new value of c but the cache for a, which might have been queried before wouldn’t be updated. We just have to make sure to document this possible conflict, as it probably goes a bit against the patter of just having on root per property. What do you think? 🙂