Graphene creates unique ids

583 views Asked by At

Here in relay tutorial they say:

Graphene creates globally unique IDs for all objects.
You may need to copy this value from the results of the first query

Those ids look like this SW5ncmVkaWVudE5vZGU6MQ==. And when querying a list of item in id field one can see that ids.

How can I get normal (int) ids? Or frontend should convert int ids into string ids?

1

There are 1 answers

0
JPG On BEST ANSWER

Create a custom relay.Node class and override the from_global_id(...) method

from graphene import relay


class MyCustomNode(relay.Node):

    @classmethod
    def from_global_id(cls, global_id):
        return global_id