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.

Some GraphQL Queries for Relationships fail on 1.2

See original GitHub issue

Environment

  • Python version: 3.8
  • Nautobot version: 1.2.2

Steps to Reproduce

  1. Have a relationship e.g. between cluster and devices (one to many)
  2. Run a graphql query like:
device(id:"bb91df1c-61ec-4a85-8138-cdb97c6c890e")
{
  name
  rel_cluster_to_device{
    id
  }
  }
}

Expected Behavior

Get the ID of the relationship

Observed Behavior

{
  "errors": [
    {
      "message": "Cannot call only() after .values() or .values_list()",
      "locations": [
        {
          "line": 5,
          "column": 3
        }
      ],
      "path": [
        "device",
        "rel_cluster_to_device"
      ]
    }
  ],
  "data": {
    "device": {
      "name": "R10-S3",
      "rel_cluster_to_device": null
    }
  }
}

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
sirtuxcommented, Jan 5, 2022

Hi @glennmatthews, I just tried the fix from #1230, and it looks good - I just wait for confirmation from @manawyrm to confirm that.

Do you think this fix can make it into a 1.2.4?

Thanks, Tom

1reaction
glennmatthewscommented, Jan 4, 2022

Also it’s worth noting that the inner id field returned by this query is not the ID of the RelationshipAssociation model instance, it’s the ID of the object on the other end of the relationship association (e.g. the Cluster object ID in your example above). Just wanted to make that clear because it tripped me up as well. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL query best practices
Use GraphQL variables to provide arguments ... The first query uses a variable ( $dogId ) for the value of the dog field's...
Read more >
GraphQL specification
GraphQL describes the types of data expected by query variables. Input types may be lists of another input type, or a non‐null variant...
Read more >
Solved: GraphQL @Cypher Query Error - Neo4j - 25746
Solved: **I have a simple graph of Part nodes and CHILD_OF relationships. There is a property "index" on the "CHILD_OF" - 25746.
Read more >
Hairy - GraphQL Rules
For GraphQL fragments working fine on the client, you need a server that will indicate in the scheme as many relationships as possible...
Read more >
Nautobot Relationships Part 2 | The NTC Mag
Query Relationship Association. Nautobot's GraphQL implementation supports querying custom-defined relationships (and their associations) using ...
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