In this video, we run a SQL query and a GraphQL query and mutation in Hasura, demonstrating the multiple ways you can access data.
Ali Spittel: [0:00] Now that we have data loaded into our database, we can write some queries to see that data.
[0:06] If you go over to the DATA tab and then click SQL, you can write normal SQL queries. I could do SELECT * FROM "users" and then click Run and see all the users that I have loaded into my database. This is helpful if you want to insert a lot of data into your database. You could do a SQL query to insert data from a CSV or something along those lines.
[0:32] You can also head over to the GraphiQL tab and write some GraphiQL queries. I'm going to use the Explorer tool to get all the users and their id and their username back. You can see that now I have both of my users.
[0:53] We can also write mutations using this GraphiQL Explorer. If you switch over to mutation here, then click that + button, you'll get all the information about creating a mutation. Using this mutation, I can insert one user into the database named "aspit." Then I'll get the username and id back.
[1:14] Hasura allows us to access and manipulate our data in multiple ways, which allows you to write multiple different types of queries.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!