Create relationship to user

Now that the view has been created, we need a way to be able to fetch user information based on the id column of the view. Let's create a manual relationship from the view online_users to the table users using the id column of the view.

Head to Console -> Data -> online_users -> Relationships page.

Add a new relationship manually by choosing the relationship type to be Object Relationship. Enter the relationship name as user. Select the configuration for the current column as id and the remote table would be users and the remote column would be id again.

We are mapping the current view's id column to users table's id column to create the relationship.

create relationship from view

Let's explore the GraphQL APIs for the relationship created.

query {
online_users {
user {

Great! We are completely done with data modelling for the app.


Get Started with GraphQL Now

Hasura Cloud gives you a fully managed, production ready GraphQL API as a service to help you build modern apps faster.