Query returns empty (Pydgraph client)


(Ayeg) #1

Hello,

I’ve been running into an issue with a query with the Pydgraph client that previously worked fine, but now it returns an empty object. Without changing the query or the schema. Doing the same query in the ratel UI returns the data like it should so I’m certain the data is there, it just seems something is going that I don’t understand.

A query for another object works just fine, so everything seems to be in order with the connection. The data is stored on disk, kept in the volume and is available on reboot as it should.

Can’t find any error messages in the logs and when logging the variable used in the query I can see it is correct (1 in this case)

What could be causing this problem?

For reference, this is what it look it looks like:

            user_workspaces_meta = """query workspaces($user:int) {
                workspaces(func: has(user))@filter(eq(user,$user)) {
                    uid                 
                    ~owner.workspace{
                        uid
                        workspace.details{
                        uid
                        title
                        description
                        }
                    }
                }
            }"""
            variable = {'$user': self.userID}
            response = client.query(user_workspaces_meta, variables=variable)

The response I get is { “workspaces”: }

In the console it is showing the correct result:


(Ayeg) #2

Found the solution!

When logging the variable I noticed it was number and not a string. I did not realize that it was probably a string before, so in order to try and fix the problem I had tried changing $user:string to $user:int.

Just after posting this I realized I did not actually try passing a string instead.
It is working like it should now