Chooce video playback speed
speed:1

Querying Data in Hasura

InstructorAli Spittel

Share this video with your friends

Send Tweet

In this video, we run a SQL query and a GraphQL query and mutation in Hasura, demonstrating the multiple ways you can access data.

This lesson is a Community Resource

A Community Resource means that it’s free to access for all. The instructor of this lesson requested it to be open to the public.

Ali Spittel: Now that we have data loaded into our database, we can write some queries to see that data.

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.

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.

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.

Hasura allows us to access and manipulate our data in multiple ways, which allows you to write multiple different types of queries.