Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'parse error on (VAR_SIGN)' in a graphql query in python

Tags:

python

graphql

I am having trouble with GraphQL queries made in python. It says that the signal $ that determine a variable in the query cannot be parsed.

Error message:

{"errors":[{"message":"Parse error on \"$\" (VAR_SIGN) at [3, 3]","locations":[{"line":3,"column":3}]}]}

Is there other way to use variables in this kind of request?

Here is my query, I didn't paste the fragment because I think it's not the problem

    query ApplicationIndexQuery(
  $status: Boolean!
  $page: Int
  $perPage: Int
  $filters: ApplicationFilter
  $sort: String
) {
  allOpportunityApplication(page: $page, per_page: $perPage, filters: $filters, sort: $sort) {
    ...ApplicationList_list
  }
}

variables = {

    "status": True,
    "page": 1,
    "perPage": 517,
    "filters": {
        "date_realized": {
            "from": "2018-12-01",
            "to": "2019-03-31"
        },
        "person_home_mc": 1535,
        "programmes": 5
    }
like image 274
Vinícius Matheus Olivieri Avatar asked Apr 02 '19 12:04

Vinícius Matheus Olivieri


Video Answer


1 Answers

query should be at the top level, but it seems like in your example it's enclosed in curly braces. See below: https://github.com/apollographql/graphql-tag/issues/180#issuecomment-386540792

like image 86
Antony Yun Avatar answered Oct 01 '22 16:10

Antony Yun