7 ms·
This looks really cool! Particularly for the embedded analytics use case. Do you have an example of how this would work on the front end with relationships. Fo
by gautambt 6y ago
This looks really cool! Particularly for the embedded analytics use case.
Do you have an example of how this would work on the front end with relationships. For example if I want to fetch posts and their comments how would the front code look like?
- ksri 6y agoYes, following relationships is a key feature of Squealy. Here is an example for a recent-questions API - https://github.com/hashedin/squealy/blob/master/squealy-app/squealy-home/dba.se.com.yml https://github.com/hashedin/squealy/blob/master/squealy-app/.... In short, with 1 GET API call that uses 3 SQL queries, you are getting a list of questions, related answers and related comments. You should parse that example as follows - 1. The first SQL query fetches all the questions, filtered by API parameters 2. The second SQL query fetches all comments for the questions selected in the first query. See the `WHERE c.postid in {{ questions.id | inclause }}` part - questions.id is coming from the output of the first query 3. The output of the first and second query is merged together on the basis of the questionid that is present in both the query output. 4. Similar approach is used for all the answers
- deleted 6y ago[deleted]