Comparison Operators with GraphQL
Comparison Operators with GraphQL
Situation: When querying a GraphQL endpoint, you might need to query from the latest timestamp. You’ll need a comparison operator for that.
Here’s are the operators, taken from this stackoverflow answer.
note: You can add these operators to any key, for example if the column name was “created” (i.e., created at 123456789 timestamp), a query might include created_gt
to mean “timestamp greater than”:
# sample query
votes(first: 1000, where: {created_gt: 123456789}) {
id
vote_id
voter
created
proposal {
id
}
}
# Other comparison operators
_gt (greater than)
_lt (less than)
_gte (greater than or equal to)
_lte (less than or equal to)
_in (equal to)
_not_in (not equal to)
For more content on data science, R, and Python find me on Twitter.