[$3000 in SQT] Allow query historical data by block range
Description
We currently allow pass a block height, and get any result less equal than this height
We now want to add a filter for block height, so it can filter data with in a specific block range
Single entities
To start with we should have the ability to query an entity by its id and specify a block range. We need to consider that we only return 100 results and there might be more in the block range.
Possible example query:
{
# current single entity query
example1: entity(id: 'foo') {
id
field1
field2
}
# extend the current query
example2: entity(id: 'foo', blockRange: [0, 100]) {
id
field1
field2
}
# a new entity name
example3: entityHistory(id: 'foo', blockRange: [0, 100]) {
id
field1
field2
}
}
Example response:
{
example1: {
id: 'foo',
field1: 1,
field2: 'bar',
},
example2: {
// Keyed by block height
5: {
id: 'foo',
field1: 1,
field2: 'bar',
},
10: {
id: 'foo',
field1: 2,
field2: 'bazz',
},
90: null, // indicates the entity was deleted
},
// example3 same result as example 2
}
Multiple entities
This is more complex and can come as another improvement at a later stage
Requirements
- Tests which generate a schema and correctly show gql being converted to the appropriate sql
- Documentation should be updated to include how to use this feature
- Backwards compatible, i.e it should not change the behaviour of any current queries
- Work with all other graphql plugins and features such as filtering, ordering, relations
Will take this up!
Will take this up!
@abhishek818 i have assigned you to this. Let us know if you have any questions
Will take this up!
@abhishek818 i have assigned you to this. Let us know if you have any questions
Added a query in draft PR, pls have a look.
hey @stwiname is this still open. like I see a draft PR but there is no contiuation of it!
and also is this is still part of developer guild !
@Gmin2, yes this is still open. The existing PR has been abandoned so feel free to pick this up