gofractally / psibase

Open source protocol enabling communities to easily self-host web applications
https://docs.psibase.io
MIT License
28 stars 7 forks source link

Graphql support for events #901

Open James-Mart opened 3 weeks ago

James-Mart commented 3 weeks ago

There ought to be a way to easily query events that returns a graphql result. If it's simpler, the query itself could still be made using SQL syntax, but we would need to be able to map the response into something graphql compatible...

Thoughts?

swatanabe commented 3 weeks ago

I don't understand what the goal is. The result of the SQL query is JSON. The only difference from GraphQL is that GraphQL adds an extra {"data":..} around the query result. The reason the queries use SQL rather than GraphQL in the first place is that the data model of the event log maps better to SQL (tables, rows, and columns) than it does to GraphQL (no way to traverse the graph, because we don't know what event fields refer to the same entity).