Closed simonw closed 3 years ago
This is where those operations are defined - because the type is an integer these integer operations are used: https://github.com/simonw/datasette-graphql/blob/7240262a8cb73a5821b7f1050453e07963579d99/datasette_graphql/utils.py#L313-L321
Then the filters are turned into a Datasette querystring here: https://github.com/simonw/datasette-graphql/blob/7240262a8cb73a5821b7f1050453e07963579d99/datasette_graphql/utils.py#L533-L546
The big clue here is sequence item 0: expected str instance, int found
. I think I see the problem:
if isinstance(value, list):
value = ",".join(value)
You can't call ",".join()
on a list of integers without casting them to strings.
This query works: https://datasette-graphql-demo.datasette.io/graphql/fixtures?query=%7B%0A%20%20table_with_pk(filter%3A%20%7Bname%3A%20%7Bin%3A%20%5B%22Row%201%22%2C%20%22Row%202%22%5D%7D%7D)%20%7B%0A%20%20%20%20nodes%20%7B%0A%20%20%20%20%20%20pk%0A%20%20%20%20%20%20name%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0A
But this query fails with an error: https://datasette-graphql-demo.datasette.io/graphql/fixtures?query=%7B%0A%20%20table_with_pk(filter%3A%20%7Bpk%3A%20%7Bin%3A%20%5B1%2C%202%5D%7D%7D)%20%7B%0A%20%20%20%20nodes%20%7B%0A%20%20%20%20%20%20pk%0A%20%20%20%20%20%20name%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0A
Error:
I tried using strings instead of integers -
table_with_pk(filter: {pk: {in: ["1", "2"]}})
- and got this error:notin:
is also affected.