graphql-python / graphql-python/graphene-django

replace relay global id with object id

Open
#957 15 comments 6 reactions 0 assignees View on GitHub
✨enhancement
Dominant language
Python
Stars
4.4k
Forks
760
PR merge metrics
No merged PRs in 30d

Description

So basically I am trying to query through the objects using relay. when I fetch the id it returns the relay global id.
```python
{
allShops(first: 1){
edges{
node{
id
name
}
}
}
}
```
output
```pytho
{
"data": {
"allShops": {
"edges": [
{
"node": {
"id": "U2hvcE5vZGU6NTA4NTRhYTUtNzJmZC00NzNmLThhNTEtNmQxNWJjYWUwNjE5",
"name": "pops"
}
}
]
}
}
}
```
it works just fine , even filtering and stuff. But the problem occurs in mutation i cant pass the relay id while updating or referencing an entry in django. I want the object id there.

**A workaround I tried**
Use this function
```python
id = from_global_id(id)
```
its in graphql_relay.node.node
but the problem is it increases a lot of my code and everywhere I want i have to use this and I have a lot of code to manage already.

**Is there any way to globally replace relay global id with model id,(i am using Django's UUID field)
keeping two ids is redundant code*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.