question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for Proxy Models

See original GitHub issue

Is there support for querying proxy models? I’m trying to query a model that has a bunch of proxy models but am getting an error. Here’s an abbreviated look at my setup:

class Column:
...

class FieldColumn(Column):
  proxy=True
class Query(graphene.ObjecType):
    column = graphene.Field(ColumnType)
    all_columns = DjangoFilterConnectionField(ColumnType)

and

class ColumnType(DjangoObjectType):
    class Meta:
        model = Column
        filter_fields = ['sheet__name', 'name']
        interfaces = (relay.Node, )
        exclude_fields = [  
            'legislation_type', 'project_stat_type', ... # weirdly have to exclude these fields because the 'type' in the variable name makes the field introspector sad
        ]

my query is:

query {
	allColumns(sheet_Name:"Simple Sheet") {
		edges {
      node{
        id, name
      }
    }
  }
}

Here’s the trace:

Traceback (most recent call last):
  File "/Users/jonathanmares/.virtualenvs/quorum/lib/python2.7/site-packages/promise/promise.py", line 65, in try_catch
    return (handler(*args, **kwargs), None)
  File "/Users/jonathanmares/.virtualenvs/quorum/lib/python2.7/site-packages/graphql/execution/executor.py", line 375, in <lambda>
    resolved
  File "/Users/jonathanmares/.virtualenvs/quorum/lib/python2.7/site-packages/graphql/execution/executor.py", line 405, in complete_value
    return complete_object_value(exe_context, return_type, field_asts, info, result)
  File "/Users/jonathanmares/.virtualenvs/quorum/lib/python2.7/site-packages/graphql/execution/executor.py", line 499, in complete_object_value
    field_asts
graphql.error.base.GraphQLError: Expected value of type "ColumnType" but got: FieldColumn.

I know this PR https://github.com/graphql-python/graphene-django/pull/156/files is waiting to be merged, but I tried running my query with the proposed changes and still get the same error.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
abettkecommented, Mar 27, 2019

IRT #599, I’ve created #603 to try and better address this issue.

0reactions
dopeboycommented, May 8, 2019

Let’s take this over to #603, thanks all.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Contact — Proxy Models
Send us your project details, and we will come back to you with a quote within 48 hours. studio@proxymodels.com WhatsApp (+49) 157 8731...
Read more >
Supporting proxy models throughout Wagtail · Issue #4973
I think we can all agree that supporting proxy models is much simpler/cleaner when proxy models have their own ContentType , and model ......
Read more >
Chapter 2 Development of Proxy Model (Less Rich Model ...
[^1] Here, we call proxy reservoir model because it is less rich in complexity and in addition is not fully based on solving...
Read more >
MRA Part 2 – Proxy Model - NGINX
In this "proxy model", you would implement mutual tls between the proxy and the target. You can use one of many approaches to...
Read more >
Causal Proxy Models for Concept-Based Model Explanations
In this paper, we show that robust causal explainability methods can be created using approximate counterfactuals, which can be written by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found