mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-24 16:03:37 +03:00
6fb181a4ee
- readd first graphql query page as it is a good link to share from external resources (like console) - add link to changelog for 2.0 - update SQL server support comments GitOrigin-RevId: 8f7baeccca38fcd645638d2832b85fcad53dabe5
55 lines
1.2 KiB
ReStructuredText
55 lines
1.2 KiB
ReStructuredText
.. meta::
|
|
:description: Make a first GraphQL query with Hasura
|
|
:keywords: hasura, docs, start, query, graphql
|
|
|
|
.. _first_graphql_query:
|
|
|
|
Making your first GraphQL query
|
|
===============================
|
|
|
|
.. contents:: Table of contents
|
|
:backlinks: none
|
|
:depth: 1
|
|
:local:
|
|
|
|
Introduction
|
|
------------
|
|
|
|
Let's create a sample table and query data from it using the Hasura console, a UI tool meant for doing exactly this:
|
|
|
|
Create a table
|
|
--------------
|
|
|
|
Head to the Hasura console, navigate to ``Data -> Create table`` and create a sample table called ``profiles`` with
|
|
the following columns:
|
|
|
|
.. code-block:: sql
|
|
|
|
profiles (
|
|
id SERIAL PRIMARY KEY, -- serial -> auto-incrementing integer
|
|
name TEXT
|
|
)
|
|
|
|
.. thumbnail:: /img/graphql/core/getting-started/create-profile-table.png
|
|
:alt: Create a table
|
|
|
|
Now, insert some sample data into the table using the ``Insert Row`` tab of the ``profiles`` table.
|
|
|
|
Try out a query
|
|
---------------
|
|
|
|
Head to the ``GraphiQL`` tab in the console and try running the following query:
|
|
|
|
.. code-block:: graphql
|
|
|
|
query {
|
|
profiles {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
|
|
You'll see that you get all the inserted data!
|
|
|
|
.. thumbnail:: /img/graphql/core/getting-started/profile-query.png
|
|
:alt: Try out a query |