docs: epic restructure

[Preview link](https://marion-docs-restructure.hasura-docs-mono.pages.dev/docs/latest/index/)

This PR is a complete restructure of documentation including the following:
- Merge [core](https://hasura.io/docs/latest/graphql/core/index/) and [cloud](https://hasura.io/docs/latest/graphql/cloud/index/) docs
- Integrate [enterprise](https://docs.ee.hasura.io/) docs
- Flip [database section](https://hasura.io/docs/latest/graphql/core/databases/index/)
- Much more

@robertjdominguez @seanparkross please add improvements and link to the sections that you've updated, so that it's easy to find for reviewers.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4882
Co-authored-by: surendran82 <26085612+surendran82@users.noreply.github.com>
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 897191003a5e20dcc525b15e571725a34dc7d76e
This commit is contained in:
Marion Schleifer 2022-07-20 18:34:24 +02:00 committed by hasura-bot
parent 359d421819
commit ee846db056
717 changed files with 21289 additions and 16011 deletions

View File

@ -0,0 +1,5 @@
{
"label": "Account management",
"position": 200,
"className": "cloud-icon"
}

View File

@ -0,0 +1,5 @@
{
"label": "Billing",
"position": 20,
"className": "cloud-icon"
}

View File

@ -0,0 +1,112 @@
---
description: Billing Owner on Hasura Cloud
title: 'Cloud: Billing Owner'
sidebar_label: Billing Owner
keywords:
- hasura
- docs
- project
- team
- collaborators
- billing
sidebar_position: 1
---
import Thumbnail from '@site/src/components/Thumbnail';
import HeadingIcon from '@site/src/components/HeadingIcon';
# Cloud: Billing Owner <HeadingIcon icon={`cloud`} size={36} />
## Introduction
You can invite a billing owner to take responsibility of the project's invoicing. The `Collaborators` tab displays the
current user who is in charge of project billing as well as the user who has been invited to take on the billing owner
responsibility.
## Invite a billing owner
### Invite a new collaborator as billing owner
Click `Invite a Collaborator` to invite a new collaborator as a billing owner by their email.
<Thumbnail src='/img/graphql/cloud/billing/collab-view.png' alt='Collaborators tab' width='1200px' />
Under the `User` collaborator type, select the `Billing Owner` privilege.
<Thumbnail
src='/img/graphql/cloud/billing/invite-bm-collab.png'
alt='User Collaborator with Billing Owner Privilege'
width='450px'
/>
:::info Note
Only a single invitation can exist at a time for a billing owner. If an invitation already exists for a billing owner,
please revoke that invitation and then invite another user.
:::
### Invite an existing collaborator to become billing owner
Click on the collaborator you want to invite as a billing owner.
Under the user's existing collaborator type, check the `Billing Owner` privilege and click `Update`.
<Thumbnail src='/img/graphql/cloud/billing/add-bm-privilege.png' alt='Add Billing Owner Privilege' width='450px' />
## Accept / reject billing owner invitation
You can see the projects that you have been invited to handle billing for on the project listing page and choose to
either accept or reject them.
<Thumbnail
src='/img/graphql/cloud/billing/project-bm-invitation.png'
alt='Projects invited to handle billing for'
width='900px'
/>
## Remove a billing owner
### Remove billing owner completely as a collaborator
Only the owner of a project can remove a collaborator with billing owner privilege and take back the responsibility of
billing for their project.
To remove a billing owner, click on the billing owner collaborator and then click on the remove icon on the top right:
<Thumbnail src='/img/graphql/cloud/billing/remove-bm.png' alt='Remove billing owner collaborator' width='450px' />
:::info Note
If the billing owner collaborator has other privileges apart from `Billing Owner`, following the above steps will remove
all those privileges too. In case you only want to remove the `Billing Owner` privilege, follow the steps under
[Remove Billing Owner Privilege](#remove_bm_privilege).
:::
### Remove only billing owner privilege for a collaborator {#remove_bm_privilege}
Only the owner of a project can remove a collaborator's billing owner privilege and take back the responsibility of
billing for their project.
To remove a collaborator's `Billing Owner` privilege, click on the billing owner collaborator.
<Thumbnail src='/img/graphql/cloud/billing/click-bm-collab.png' alt='Click billing owner collaborator' width='1000px' />
Remove the `Billing Owner` privilege for that user and click `Update`.
<Thumbnail
src='/img/graphql/cloud/billing/remove-bm-privilege.png'
alt='Remove billing owner privilege'
width='450px'
/>
## Resend billing owner invitation
If you have invited a billing owner, you can click on the `Invited` button to resend the invitation.
<Thumbnail
src='/img/graphql/cloud/billing/resend-bm-invitation.png'
alt='Resend billing owner invitation'
width='1000px'
/>

View File

@ -0,0 +1,42 @@
---
description: Hasura Cloud coupon and credits
title: 'Cloud: Coupons and credits'
keywords:
- hasura
- docs
- cloud
- coupon
- credits
sidebar_position: 3
sidebar_label: Hasura Cloud Credits
---
import Thumbnail from '@site/src/components/Thumbnail';
import HeadingIcon from '@site/src/components/HeadingIcon';
# Cloud: Coupons and credits <HeadingIcon icon={`cloud`} size={36} />
## Introduction
If you have a coupon, you can redeem it from the dashboard to get a credit waiver on your next invoice. Discounts will
be adjusted while creating the invoice.
## Redeem a coupon
Navigate to the `Billing` tab, click on `Coupons and Credits`, enter the code and click on the redeem button. Only one
coupon is applied.
:::info
Note If there is an active coupon and another coupon is applied, then the later coupon is used.
:::
<Thumbnail src='/img/graphql/cloud/billing/coupon_redemption.png' alt='Coupons and Credits' />
<Thumbnail src='/img/graphql/cloud/billing/applied_coupon.png' alt='Applied coupon' />
## View applied coupon
You can see the applied coupon on the `Active` tab under `Coupon and Credits` and you can view previous coupons on the
`Past` tab.

View File

@ -0,0 +1,31 @@
---
description: Hasura Cloud billing
title: 'Cloud: Billing'
sidebar_label: Hasura Cloud billing
keywords:
- hasura
- docs
- cloud
- billing
- payment
- invoice
slug: index
---
import Thumbnail from '@site/src/components/Thumbnail';
import HeadingIcon from '@site/src/components/HeadingIcon';
# Cloud: Billing <HeadingIcon icon={`cloud`} size={36} />
## Introduction
All Hasura Cloud billing related details can be found under the `Billing` tab in the Hasura Cloud dashboard
<Thumbnail src='/img/graphql/cloud/billing/billing.png' alt='Billing' />
## Details
- [Billing owner](/billing-owner.mdx)
- [Manage payment methods](/payment-methods.mdx)
- [Coupons and credits](/credits.mdx)
- [Receipts](/receipts.mdx)

View File

@ -1,5 +1,7 @@
---
description: Manage Payment Methods
title: 'Cloud: Manage payment methods'
sidebar_label: Manage Payment Methods
keywords:
- hasura
- docs
@ -12,9 +14,10 @@ keywords:
sidebar_position: 2
---
import Thumbnail from "@site/src/components/Thumbnail";
import Thumbnail from '@site/src/components/Thumbnail';
import HeadingIcon from '@site/src/components/HeadingIcon';
# Manage payment methods
# Cloud: Manage payment methods <HeadingIcon icon={`cloud`} size={36} />
## Introduction
@ -24,18 +27,11 @@ You can add one or more cards as a payment method for the upcoming billing cycle
Go to the billing section, and click on `View Cards`.
<Thumbnail
src="/img/graphql/cloud/billing/manage_cards.png"
alt="view saved cards"
/>
<Thumbnail src='/img/graphql/cloud/billing/manage_cards.png' alt='view saved cards' />
Click the `+` sign to add a new card.
<Thumbnail
src="/img/graphql/cloud/billing/add_new_card.png"
alt="add a new card"
width="437px"
/>
<Thumbnail src='/img/graphql/cloud/billing/add_new_card.png' alt='add a new card' width='437px' />
After adding appropriate values, click `Save`.
@ -43,29 +39,26 @@ After adding appropriate values, click `Save`.
The default card is used for the payment of upcoming billing cycles.
Select the card you want to set as the default payment method or add a new card, check the `Set Card as Default` option and click `Save`.
Select the card you want to set as the default payment method or add a new card, check the `Set Card as Default` option
and click `Save`.
<Thumbnail
src="/img/graphql/cloud/billing/set_existing_default.png"
alt="set an exiting card as the default card"
width="437px"
src='/img/graphql/cloud/billing/set_existing_default.png'
alt='set an exiting card as the default card'
width='437px'
/>
<Thumbnail
src="/img/graphql/cloud/billing/set_new_default.png"
alt="Add a new card as the default card"
width="437px"
src='/img/graphql/cloud/billing/set_new_default.png'
alt='Add a new card as the default card'
width='437px'
/>
## Delete a card
Select the card you want to delete and click the `Remove Card` option.
<Thumbnail
src="/img/graphql/cloud/billing/delete_card.png"
alt="Delete card"
width="437px"
/>
<Thumbnail src='/img/graphql/cloud/billing/delete_card.png' alt='Delete card' width='437px' />
:::info Note

View File

@ -0,0 +1,49 @@
---
description: Hasura Cloud receipts
title: 'Cloud: Receipts'
sidebar_label: Hasura Cloud receipts
keywords:
- hasura
- docs
- cloud
- payment
- receipts
sidebar_position: 4
---
import Thumbnail from '@site/src/components/Thumbnail';
import HeadingIcon from '@site/src/components/HeadingIcon';
# Cloud: Receipts <HeadingIcon icon={`cloud`} size={36} />
## Introduction
Receipts, against successful payment of invoices for each billing cycle, are mailed to the email associated with your
Hasura Cloud account.
If you wish to receive receipts on another email, in addition to your account's default email, please configure a
billing email.
## Configure billing email
Go to the billing section and click on `Invoice Settings`.
<Thumbnail src='/img/graphql/cloud/billing/invoice_settings.png' alt='invoice settings' />
Click on `Billing Email` and enter the email you want to receive receipts on.
<Thumbnail src='/img/graphql/cloud/billing/configure_billing_email.png' alt='configure billing email' width='437px' />
Click `Save`.
For all payments made, receipt will also be mailed to the billing email in addition to your account's default email.
## Delete billing email
Go to the billing section and click on `Invoice Settings`.
<Thumbnail src='/img/graphql/cloud/billing/invoice_settings.png' alt='invoice settings' />
Click on `Billing Email` and click `Remove billing email`.
<Thumbnail src='/img/graphql/cloud/billing/delete_billing_email.png' alt='delete billing email' width='437px' />

View File

@ -0,0 +1,51 @@
---
sidebar_label: Change email
title: 'Cloud: Change email address'
description: Hasura Cloud Email Change
keywords:
- hasura
- docs
- cloud
- email
sidebar_position: 10
---
import Thumbnail from '@site/src/components/Thumbnail';
import HeadingIcon from '@site/src/components/HeadingIcon';
# Cloud: Change email address <HeadingIcon icon={`cloud`} size={36} />
## Introduction
You can edit the email address on your Hasura Cloud account to another email from the `Account Settings` page.
## Changing email for users logged in using email {#email-change}
[Sign in](https://cloud.hasura.io/login?redirect_url=/) to your Hasura Cloud account using email and click `My Account`.
On the `Account Settings` page, select the `Edit` button.
<Thumbnail src='/img/graphql/cloud/account-settings/account-settings-tab.png' alt='Account Management' width='1100px' />
Enter the email you want to transfer the account to and click the `Change` button to send a transfer request.
<Thumbnail src='/img/graphql/cloud/account-settings/edit-email-input.png' alt='edit email section' width='800px' />
The invitee receives an email verification mail. Once the invitee clicks the link, it logs out the existing user and
redirects the invitee to the Hasura Cloud login page.
The user can now log in to Hasura Cloud using the new email and the password for the old email.
## Changing email for users with social logins
If you logged in to Hasura Cloud with your social login, you must reset your password to initiate the email change
process. On the [Sign in](https://cloud.hasura.io/login?redirect_url=/) page, select `Forgot?`.
<Thumbnail src='/img/graphql/cloud/account-settings/forgot-password.png' alt='Forgot password' width='450px' />
Next, enter the new email id and click **Recover Password**. Set a new password by clicking on the reset password link
sent to your email address.
You can now log in with the email and this new password and follow the steps mentioned in the
[above section](#email-change) to change the email.
You can also use the social login associated with the new email to log in to Hasura Cloud!

View File

@ -0,0 +1,23 @@
---
slug: index
title: 'Cloud: Account management'
description: Hasura Cloud Account Management
keywords:
- hasura
- docs
- cloud
- account
- email
sidebar_label: Account management
---
import HeadingIcon from '@site/src/components/HeadingIcon';
# Cloud: Account management <HeadingIcon icon={`cloud`} size={36} />
## Introduction
On your Hasura Cloud `My Account` page, you can manage account-related settings such as changing the email, creating
access tokens, and managing database session connections.
- [Change email address on Hasura Cloud](/account-management/email-change.mdx)

View File

@ -1,4 +1,4 @@
{
"label": "Actions",
"position": 3
}
"position": 80
}

View File

@ -1,7 +1,7 @@
---
sidebar_label: Action handlers
sidebar_position: 3
description: Action handlers for Hasura actions
description: Action handlers for Hasura Actions
keywords:
- hasura
- docs
@ -168,9 +168,9 @@ a header to the action that is automatically sent with each request to
the webhook, and then adding a check against that in your action
handler.
- [Step 1: Configure your Hasura instance](/graphql/core/actions/action-handlers.mdx#configure-your-hasura-instance)
- [Step 2: Add a header to your action](/graphql/core/actions/action-handlers.mdx#add-a-header-to-your-action)
- [Step 3: Verify the secret in your action handler](/graphql/core/actions/action-handlers.mdx#verify-the-secret-in-your-action-handler)
- [Step 1: Configure your Hasura instance](/actions/action-handlers.mdx#configure-your-hasura-instance)
- [Step 2: Add a header to your action](/actions/action-handlers.mdx#add-a-header-to-your-action)
- [Step 3: Verify the secret in your action handler](/actions/action-handlers.mdx#verify-the-secret-in-your-action-handler)
:::info Note
@ -229,8 +229,8 @@ Save the changes and run `hasura metadata apply` to set the headers.
</TabItem>
<TabItem value="api" label="API">
Headers can be set when [creating](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-create-action) or
[updating](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-update-action) an action via the metadata API.
Headers can be set when [creating](/api-reference/metadata-api/actions.mdx#metadata-create-action) or
[updating](/api-reference/metadata-api/actions.mdx#metadata-update-action) an action via the metadata API.
```http {12-17}
POST /v1/metadata HTTP/1.1
@ -267,8 +267,8 @@ X-Hasura-Role: admin
:::info Note
Before creating an action via the [create_action metadata API](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-create-action), all custom types
need to be defined via the [set_custom_types](/graphql/core/api-reference/metadata-api/custom-types.mdx#metadata-set-custom-types) metadata API.
Before creating an action via the [create_action metadata API](/api-reference/metadata-api/actions.mdx#metadata-create-action), all custom types
need to be defined via the [set_custom_types](/api-reference/metadata-api/custom-types.mdx#metadata-set-custom-types) metadata API.
:::

View File

@ -57,7 +57,7 @@ Save the changes and run `hasura metadata apply` to set the permissions.
</TabItem>
<TabItem value="api" label="API">
Action permissions can be set by using the [create_action_permission](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-create-action-permission) metadata API:
Action permissions can be set by using the [create_action_permission](/api-reference/metadata-api/actions.mdx#metadata-create-action-permission) metadata API:
```http
POST /v1/metadata HTTP/1.1

View File

@ -81,7 +81,7 @@ mutation updateAuthorAndGetArticles($id: Int, $name: String) {
}
```
See more details at [custom object type relationships](/graphql/core/actions/types.mdx)
See more details at [custom object type relationships](/actions/types.mdx)
### Creating relationships for custom object types
@ -128,7 +128,7 @@ Save the changes and run `hasura metadata apply` to create the relationship.
<TabItem value="api" label="API">
Action relationships can be added while defining custom types via the
[set_custom_types](/graphql/core/api-reference/metadata-api/custom-types.mdx#metadata-set-custom-types) metadata API:
[set_custom_types](/api-reference/metadata-api/custom-types.mdx#metadata-set-custom-types) metadata API:
```http {20-29}
POST /v1/metadata HTTP/1.1

View File

@ -1,7 +1,7 @@
---
sidebar_label: Async actions
sidebar_label: Async Actions
sidebar_position: 4
description: Async actions
description: Async Actions
keywords:
- hasura
- docs
@ -9,7 +9,7 @@ keywords:
- async actions
---
# Async actions
# Async Actions
Sometimes you may not want to wait for an action to complete before
sending a response back to the client (say if the business logic takes a

View File

@ -111,11 +111,11 @@ The codegen files will be generated at the `output_dir` path from
As of now, Hasura provides codegen for a few frameworks
(`nodejs-express`, `typescript-zeit`, `python-flask` and many more). You
can see the full list in the `Codegen` tab on the console after you've
[created an action](/graphql/core/actions/create.mdx).
[created an action](/actions/create.mdx).
We will continue adding more examples to the documentation.
- [Python & Flask](/graphql/core/actions/codegen/python-flask.mdx)
- [Python & Flask](/actions/codegen/python-flask.mdx)
### Building your own codegen

View File

@ -25,7 +25,7 @@ This page describes how to use Hasura actions and codegen to build a Python & Fl
We will assume a `user` table with the fields `email` and `password`.
We create two [actions](/graphql/core/actions/create.mdx), each with its own set of [custom types](/graphql/core/actions/types.mdx):
We create two [actions](/actions/create.mdx), each with its own set of [custom types](/actions/types.mdx):
1. `Signup`: returns a `CreateUserOutput`

View File

@ -1,7 +1,7 @@
---
sidebar_label: Creating actions
sidebar_label: Creating Actions
sidebar_position: 1
description: Creating Hasura actions
description: Creating Hasura Actions
keywords:
- hasura
- docs
@ -40,7 +40,8 @@ There is no setup required for defining actions via the console.
</TabItem>
<TabItem value="cli" label="CLI">
[Install](/graphql/core/hasura-cli/install-hasura-cli.mdx) or [update to](/graphql/core/hasura-cli/hasura_update-cli.mdx) the latest version of Hasura CLI.
[Install](/hasura-cli/install-hasura-cli.mdx) or [update to](/hasura-cli/commands/hasura_update-cli.mdx) the latest
version of Hasura CLI.
You can either get started with an existing project or create a new project.
@ -69,7 +70,7 @@ Run `hasura metadata export` so that you get server's metadata into the `metadat
</TabItem>
<TabItem value="api" label="API">
There is no setup required for defining actions via the [actions metadata API](/graphql/core/api-reference/metadata-api/actions.mdx).
There is no setup required for defining actions via the [actions metadata API](/api-reference/metadata-api/actions.mdx).
</TabItem>
</Tabs>
@ -144,7 +145,7 @@ type LoginResponse {
</TabItem>
<TabItem value="api" label="API">
It is essential that the custom types used in the action are defined *beforehand* via the [set_custom_types](/graphql/core/api-reference/metadata-api/custom-types.mdx#metadata-set-custom-types) metadata API:
It is essential that the custom types used in the action are defined *beforehand* via the [set_custom_types](/api-reference/metadata-api/custom-types.mdx#metadata-set-custom-types) metadata API:
```http
POST /v1/metadata HTTP/1.1
@ -172,7 +173,7 @@ X-Hasura-Role: admin
}
```
Once the custom types are defined, we can create an action via the [create_action metadata API](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-create-action):
Once the custom types are defined, we can create an action via the [create_action metadata API](/api-reference/metadata-api/actions.mdx#metadata-create-action):
```http
POST /v1/metadata HTTP/1.1
@ -261,9 +262,9 @@ Update the `handler` to the above endpoint.
</TabItem>
<TabItem value="api" label="API">
The action handler must be set when creating an action via the [create_action metadata API](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-create-action).
The action handler must be set when creating an action via the [create_action metadata API](/api-reference/metadata-api/actions.mdx#metadata-create-action).
It can be updated later by using the [update_action metadata API](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-update-action).
It can be updated later by using the [update_action metadata API](/api-reference/metadata-api/actions.mdx#metadata-update-action).
</TabItem>
</Tabs>
@ -283,7 +284,7 @@ ENV variable whose value is set to `https://my-handler-endpoint`
:::info Note
If you are running Hasura using Docker, ensure that the Hasura Docker container can reach the handler endpoint. See [this page](/graphql/core/guides/docker-networking.mdx) for Docker networking.
If you are running Hasura using Docker, ensure that the Hasura Docker container can reach the handler endpoint. See [this page](/guides/docker-networking.mdx) for Docker networking.
:::
@ -305,7 +306,7 @@ Run `hasura metadata apply`.
</TabItem>
<TabItem value="api" label="API">
An action will be created when sending a request to the [create_action metadata API](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-create-action).
An action will be created when sending a request to the [create_action metadata API](/api-reference/metadata-api/actions.mdx#metadata-create-action).
</TabItem>
</Tabs>
@ -396,7 +397,7 @@ type AddResult {
</TabItem>
<TabItem value="api" label="API">
It is essential that the custom types used in the action are defined *beforehand* via the [set_custom_types](/graphql/core/api-reference/metadata-api/custom-types.mdx#metadata-set-custom-types) metadata API:
It is essential that the custom types used in the action are defined *beforehand* via the [set_custom_types](/api-reference/metadata-api/custom-types.mdx#metadata-set-custom-types) metadata API:
```http
POST /v1/metadata HTTP/1.1
@ -424,7 +425,7 @@ X-Hasura-Role: admin
}
```
Once the custom types are defined, we can create an action via the [create_action metadata API](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-create-action):
Once the custom types are defined, we can create an action via the [create_action metadata API](/api-reference/metadata-api/actions.mdx#metadata-create-action):
```http
POST /v1/metadata HTTP/1.1
@ -510,9 +511,9 @@ Update the `handler` to the above endpoint.
</TabItem>
<TabItem value="api" label="API">
The action handler must be set when creating an action via the Once the custom types are defined, we can create an action via the [create_action metadata API](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-create-action).
The action handler must be set when creating an action via the Once the custom types are defined, we can create an action via the [create_action metadata API](/api-reference/metadata-api/actions.mdx#metadata-create-action).
It can be updated later by using the [update_action metadata API](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-update-action).
It can be updated later by using the [update_action metadata API](/api-reference/metadata-api/actions.mdx#metadata-update-action).
</TabItem>
</Tabs>
@ -543,7 +544,7 @@ Run `hasura metadata apply`.
</TabItem>
<TabItem value="api" label="API">
An action will be created when sending a request to the [create_action metadata API](/graphql/core/api-reference/metadata-api/actions.mdx#metadata-create-action).
An action will be created when sending a request to the [create_action metadata API](/api-reference/metadata-api/actions.mdx#metadata-create-action).
</TabItem>
</Tabs>

View File

@ -1,7 +1,7 @@
---
sidebar_label: Debugging actions
sidebar_label: Debugging
sidebar_position: 10
description: Debugging Hasura actions
description: Debugging Hasura Actions
keywords:
- hasura
- docs
@ -18,7 +18,7 @@ While you're developing actions for your application, to debug faster
you may want to see the exact details of the webhook call for the action
as well.
To do so, start the server in [debugging mode](/graphql/core/deployment/graphql-engine-flags/config-examples.mdx#dev-mode). In the case
To do so, start the server in [debugging mode](/deployment/graphql-engine-flags/config-examples.mdx#dev-mode). In the case
of errors, the GraphQL response will contain debugging information of
the webhook calls in the `extensions.internal` field.

View File

@ -1,5 +1,4 @@
---
sidebar_label: Deriving actions
sidebar_position: 6
description: Deriving Hasura actions
keywords:
@ -13,7 +12,7 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Thumbnail from "@site/src/components/Thumbnail";
# Deriving actions
# Deriving Actions
## Introduction
@ -176,7 +175,7 @@ from the browser where the action was created.
<TabItem value="cli" label="CLI">
You will have to set up codegen in the CLI first to do this as explained
in [Generating handler code for your action](/graphql/core/actions/codegen/index.mdx#actions-codegen-execute)
in [Generating handler code for your action](/actions/codegen/index.mdx#actions-codegen-execute)
After saving the GraphQL types generated by the actions create command
in the previous section, the CLI will prompt you if you would like to
@ -201,7 +200,7 @@ GraphQL API but still want to use it from your action handler.
To achieve this you can mark the mutation as `backend_only` so that it
can be accessed only via "trusted sources". See
[Backend only](/graphql/core/auth/authorization/permission-rules.mdx#backend-only-permissions) for more details
[Backend only](/auth/authorization/permission-rules.mdx#backend-only-permissions) for more details
Setting `backend-only` is currently available for insert, update and delete mutations.

View File

@ -105,7 +105,7 @@ type UserInfo {
}
```
Read more about [custom types](/graphql/core/actions/types.mdx).
Read more about [custom types](/actions/types.mdx).
### Handler
@ -114,7 +114,7 @@ run when the action is executed. This can be done in an HTTP webhook,
also called the action handler. It could be a REST endpoint or a
serverless function.
Learn more about [writing an action handler](/graphql/core/actions/action-handlers.mdx).
Learn more about [writing an action handler](/actions/action-handlers.mdx).
### Kind
@ -122,7 +122,7 @@ Learn more about [writing an action handler](/graphql/core/actions/action-handle
- **Synchronous**: Sync actions return a response to the client after
receiving a response from the handler.
- **Asynchronous**: [Async actions](/graphql/core/actions/async-actions.mdx) return an
- **Asynchronous**: [Async actions](/actions/async-actions.mdx) return an
`action id` as response to the client before receiving a response
from the handler and allow the client to subscribe to the actual
response using the `action id`.
@ -155,22 +155,22 @@ up serverless functions as resolvers.
**Remote schemas**
If you have an existing GraphQL API or if you're comfortable building a
GraphQL server yourself, you can use [remote schemas](/graphql/core/remote-schemas/index.mdx)
GraphQL server yourself, you can use [remote schemas](/remote-schemas/index.mdx)
to add custom types and resolvers.
## Learn more
- [Creating actions](/graphql/core/actions/create.mdx)
- [Custom types](/graphql/core/actions/types.mdx)
- [Action handlers](/graphql/core/actions/action-handlers.mdx)
- [Async actions](/graphql/core/actions/async-actions.mdx)
- [Codegen](/graphql/core/actions/codegen/index.mdx)
- [Deriving actions](/graphql/core/actions/derive.mdx)
- [Actions permissions](/graphql/core/actions/action-permissions.mdx)
- [Actions relationships](/graphql/core/actions/action-relationships.mdx)
- [REST Connectors for actions](/graphql/core/actions/rest-connectors.mdx)
- [Debugging actions](/graphql/core/actions/debugging.mdx)
- [Cleaning up async action logs](/graphql/core/actions/logs-clean-up.mdx)
- [Creating actions](/actions/create.mdx)
- [Custom types](/actions/types.mdx)
- [Action handlers](/actions/action-handlers.mdx)
- [Async actions](/actions/async-actions.mdx)
- [Codegen](/actions/codegen/index.mdx)
- [Deriving actions](/actions/derive.mdx)
- [Actions permissions](/actions/action-permissions.mdx)
- [Actions relationships](/actions/action-relationships.mdx)
- [REST Connectors for actions](/actions/rest-connectors.mdx)
- [Debugging actions](/actions/debugging.mdx)
- [Cleaning up async action logs](/actions/logs-clean-up.mdx)
<!--

View File

@ -1,5 +1,5 @@
---
sidebar_label: Cleaning up async action logs
sidebar_label: async Action logs clean up
sidebar_position: 11
description: Clean up async action logs
keywords:
@ -10,11 +10,11 @@ keywords:
- async actions
---
# Cleaning up async action logs
# Cleaning up async Action logs
## Introduction
Hasura stores action logs of [async actions](/graphql/core/actions/async-actions.mdx) in a table
Hasura stores action logs of [async actions](/actions/async-actions.mdx) in a table
in **the "hdb_catalog" schema of the Hasura metadata database**.
As the table gets larger, you may want to prune it. You can use any of the following options to prune your logs depending on

View File

@ -1,7 +1,7 @@
---
sidebar_label: REST Connectors for actions
sidebar_label: REST Connectors
sidebar_position: 9
description: REST connectors for actions
description: REST connectors for Hasura Actions
keywords:
- hasura
- docs
@ -15,7 +15,7 @@ import TabItem from '@theme/TabItem';
import TOCInline from "@theme/TOCInline";
import Thumbnail from "@site/src/components/Thumbnail";
# REST Connectors for actions
# REST Connectors for Actions
## Introduction
@ -383,7 +383,7 @@ then you should provide the template URL as `{{$base_url}}/{{escapeUri $session_
### Request Body
You can generate a custom request body by configuring a template to transform the default payload to a custom payload. Request body could be provided using the `body` field
as an [object](/graphql/core/api-reference/syntax-defs.mdx/#bodytransform), which additionally gives the ability to disable request body,
as an [object](/api-reference/syntax-defs.mdx/#bodytransform), which additionally gives the ability to disable request body,
transform request body to `application/json`, or transform request body to `x_www_form_urlencoded` formats.
- [Disabling Request Body](#disabling-request-body)
@ -783,6 +783,6 @@ The transform is given by:
<!-- Shared Link Variables -->
[metadata-create-action]: /graphql/core/api-reference/metadata-api/actions.mdx#metadata-create-action
[metadata-update-action]: /graphql/core/api-reference/metadata-api/actions.mdx#metadata-update-action
[RequestTransformation]: /graphql/core/api-reference/syntax-defs.mdx#requesttransformation
[metadata-create-action]: /api-reference/metadata-api/actions.mdx#metadata-create-action
[metadata-update-action]: /api-reference/metadata-api/actions.mdx#metadata-update-action
[RequestTransformation]: /api-reference/syntax-defs.mdx#requesttransformation

View File

@ -15,21 +15,18 @@ slug: types/index
## Introduction
You can add custom GraphQL types in Hasura that you can utilise for
defining your actions.
You can add custom GraphQL types in Hasura that you can utilise for defining your actions.
:::caution Limitations
It is currently not possible to define `Interfaces` and `Union types` as
custom types
It is currently not possible to define `Interfaces` and `Union types` as custom types
:::
## Object types
The most basic components of a GraphQL schema are object types, which
just represent a kind of object a GraphQL query can return, and what
fields it has. In the GraphQL SDL, we might represent it like this:
The most basic components of a GraphQL schema are object types, which just represent a kind of object a GraphQL query
can return, and what fields it has. In the GraphQL SDL, we might represent it like this:
```graphql
type UserInfo {
@ -40,9 +37,8 @@ type UserInfo {
This is an object type called `UserInfo` that has two fields:
- `accessToken`: This field is of type `String!` (non-nullable
`String`)
- `userId`: This field is of type `Int!` (non-nullable `Int`)
- `accessToken`: This field is of type `String!` (non-nullable `String`)
- `userId`: This field is of type `Int!` (non-nullable `Int`)
From version `v2.2.0` onwards, Hasura GraphQL engine supports nested objects.
@ -79,8 +75,8 @@ type UserObj {
### Relationships
Custom object types can be connected to the rest of the graph by setting up
[action relationships](/graphql/core/databases/postgres/schema/remote-relationships/action-relationships.mdx) with tables/views.
Custom object types can be connected to the rest of the graph by setting up
[action relationships](/schema/postgres/remote-relationships/action-relationships.mdx) with tables/views.
**For example**, given the object type:
@ -100,12 +96,10 @@ order (id int, user_id int, ...)
We can create:
- an **object relationship** called `loggedInUser` between the
`UserInfo` object type and the `user` table via the
`UserInfo.userId` and `user.id` fields.
- an **array relationship** called `userOrders` between the `UserInfo`
object type and the `order` table via the `UserInfo.userId` and
`order.user_id` fields.
- an **object relationship** called `loggedInUser` between the `UserInfo` object type and the `user` table via the
`UserInfo.userId` and `user.id` fields.
- an **array relationship** called `userOrders` between the `UserInfo` object type and the `order` table via the
`UserInfo.userId` and `order.user_id` fields.
The object type will now be modified as:
@ -120,18 +114,16 @@ type UserInfo {
:::info Note
Only fields with non-list scalar types (e.g. `Int`, `String`) can be
used to define relationships
Only fields with non-list scalar types (e.g. `Int`, `String`) can be used to define relationships
:::
:::caution Limitations
Hasura has the following limitations for relationship in nested object
types:
Hasura has the following limitations for relationship in nested object types:
1. For nested objects, relationships can only be defined for top-level
fields. For example, for the following type definition:
1. For nested objects, relationships can only be defined for top-level fields. For example, for the following type
definition:
```graphql
type UserInfo {
@ -147,22 +139,18 @@ types:
}
```
relationships can only be defined using `accessToken` and `userID`,
you cannot use `name`, `favFood` or `isAdmin` fields in a
relationship definition.
relationships can only be defined using `accessToken` and `userID`, you cannot use `name`, `favFood` or `isAdmin`
fields in a relationship definition.
2. For `async` actions, you cannot have nested object types and
relationships in the same action.
2. For `async` actions, you cannot have nested object types and relationships in the same action.
:::
## Input types
You can pass complex objects as arguments to queries and mutations. This
is particularly valuable in cases where you might want to pass in a
whole object to be created. In the GraphQL SDL, input types look exactly
the same as regular object types, but with the keyword input instead of
type:
You can pass complex objects as arguments to queries and mutations. This is particularly valuable in cases where you
might want to pass in a whole object to be created. In the GraphQL SDL, input types look exactly the same as regular
object types, but with the keyword input instead of type:
```graphql
input LoginInfo {
@ -171,50 +159,44 @@ input LoginInfo {
}
```
A field of an input type could be a `scalar`, an `enum` or another input
type.
A field of an input type could be a `scalar`, an `enum` or another input type.
[See reference](https://graphql.org/learn/schema/#input-types)
## Scalar types
A GraphQL object type has a name and fields, but at some point those
fields have to resolve to some concrete data. That's where the scalar
types come in: they represent the leaves of the query.
A GraphQL object type has a name and fields, but at some point those fields have to resolve to some concrete data.
That's where the scalar types come in: they represent the leaves of the query.
### Inbuilt scalars
Hasura comes with some default GraphQL scalars that you can directly
start using while defining your actions:
Hasura comes with some default GraphQL scalars that you can directly start using while defining your actions:
- `Int`: A signed 32bit integer.
- `Float`: A signed double-precision floating-point value.
- `String`: A UTF8 character sequence.
- `Boolean`: true or false.
- `ID`: The ID scalar type represents a unique identifier, often used
to refetch an object or as the key for a cache. The ID type is
serialized in the same way as a String; however, defining it as an
ID signifies that it is not intended to be humanreadable.
- `Int`: A signed 32bit integer.
- `Float`: A signed double-precision floating-point value.
- `String`: A UTF8 character sequence.
- `Boolean`: true or false.
- `ID`: The ID scalar type represents a unique identifier, often used to refetch an object or as the key for a cache.
The ID type is serialized in the same way as a String; however, defining it as an ID signifies that it is not intended
to be humanreadable.
[See reference](https://graphql.org/learn/schema/#scalar-types)
### Custom scalars
Hasura allows you to define custom scalars. For example, if you want to
define a scalar called `Date`, you can define it like.
Hasura allows you to define custom scalars. For example, if you want to define a scalar called `Date`, you can define it
like.
```graphql
scalar Date
```
These scalars can be used as arguments of queries and mutations or as
fields of object types and input types.
These scalars can be used as arguments of queries and mutations or as fields of object types and input types.
:::info Postgres scalars
Postgres base types are implicitly made available as GraphQL scalars;
there is no need to declare them separately. For example, in the
definition
Postgres base types are implicitly made available as GraphQL scalars; there is no need to declare them separately. For
example, in the definition
```graphql
type User {
@ -224,8 +206,8 @@ type User {
}
```
the `uuid` and `geography` types are assumed to refer to Postgres
scalars (assuming no other definition for them is provided).
the `uuid` and `geography` types are assumed to refer to Postgres scalars (assuming no other definition for them is
provided).
:::
@ -243,21 +225,17 @@ type Mutation {
For corresponding custom object type definition of `UserInfo`, refer to [Object Types](#object-types)
In case the response type is a list of scalars (let's say, `Int`), the output type in the above action definition can be `[Int]`.
In case the response type is a list of scalars (let's say, `Int`), the output type in the above action definition can be
`[Int]`.
## Enum types
Enums are a special kind of scalar that is restricted to a particular
set of allowed values. This allows you to:
Enums are a special kind of scalar that is restricted to a particular set of allowed values. This allows you to:
- Validate that any arguments of this type are one of the allowed
values
- Communicate through the type system that a field will always be one
of a finite set of values
- Validate that any arguments of this type are one of the allowed values
- Communicate through the type system that a field will always be one of a finite set of values
Here's what an enum definition might look like in the GraphQL schema
language:
Here's what an enum definition might look like in the GraphQL schema language:
```graphql
enum Color {
@ -267,13 +245,13 @@ enum Color {
}
```
This means that wherever we use the type `Color` in our schema, we
expect it to be exactly one of RED, GREEN, or BLUE.
This means that wherever we use the type `Color` in our schema, we expect it to be exactly one of RED, GREEN, or BLUE.
[See reference](https://graphql.org/learn/schema/#enumeration-types)
:::info Additional Resources
Introduction to Hasura Actions - [View Recording](https://hasura.io/events/webinar/hasura-actions/?pg=docs&plcmt=body&cta=view-recording&tech=).
Introduction to Hasura Actions -
[View Recording](https://hasura.io/events/webinar/hasura-actions/?pg=docs&plcmt=body&cta=view-recording&tech=).
:::

View File

@ -1,4 +1,4 @@
{
"label": "API Reference",
"position": 11
}
"position": 170
}

View File

@ -6,13 +6,15 @@ keywords:
- docs
- API
- API reference
sidebar_position: 15
sidebar_position: 13
sidebar_label: Hasura Cloud API Reference
sidebar_class_name: cloud-icon
---
import TOCInline from "@theme/TOCInline";
import Thumbnail from "@site/src/components/Thumbnail";
# API Reference
# Hasura Cloud API Reference
## Introduction
@ -58,13 +60,10 @@ mutation createProject {
createTenant(
cloud: "aws"
region: "us-east-2"
envs: [{
key: "HASURA_GRAPHQL_CORS_DOMAIN",
value: "*"
}, {
key: "MY_ENV_VAR_1",
value: "my value 1"
}]
envs: [
{ key: "HASURA_GRAPHQL_CORS_DOMAIN", value: "*" }
{ key: "MY_ENV_VAR_1", value: "my value 1" }
]
) {
id
name
@ -129,9 +128,9 @@ mutation updateTenantEnv {
tenantId: "7a79cf94-0e53-4520-a560-1b02bf522f08"
currentHash: "6902a395d70072fbf8d36288f0eacc36c9d82e68"
envs: [
{ key: "HASURA_GRAPHQL_ENABLE_CONSOLE", value: "true" },
{ key: "HASURA_GRAPHQL_ENABLE_CONSOLE", value: "true" }
{
key: "ACTIONS_ENDPOINT",
key: "ACTIONS_ENDPOINT"
value: "https://my-actions-endpoint.com/actions"
}
]
@ -154,22 +153,22 @@ mutation createGitHubPreviewApp {
githubRepoDetails: {
branch: "main"
owner: "my-org"
repo: "my-repo",
repo: "my-repo"
directory: "backend/hasura"
},
}
projectOptions: {
cloud: "aws",
region: "us-east-2",
plan: "cloud_free",
cloud: "aws"
region: "us-east-2"
plan: "cloud_free"
name: "my-app_name"
envVars: [
{ key: "HASURA_GRAPHQL_AUTH_HOOK", value: "https://my-webhook.com" },
{ key: "HASURA_GRAPHQL_AUTH_HOOK", value: "https://my-webhook.com" }
{ key: "MY_ENV_VAR_1", value: "my value 1" }
]
}
}
) {
githubPreviewAppJobID
githubPreviewAppJobID
}
}
```
@ -177,30 +176,29 @@ mutation createGitHubPreviewApp {
#### Input arguments
| Argument | Description |
|----------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `githubPersonalAccessToken` | GitHub personal access token for Hasura Cloud to access the Migrations and Metadata from your repository. Refer to GitHub docs on how to create a [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). The token should have read access to the repository. |
| under `githubRepoDetails`: `owner` | GitHub repository owner (user or organisation) |
| under `githubRepoDetails`: `repo` | GitHub repository name. |
| under `githubRepoDetails`: `branch` | Name of the branch from which to create a Preview App. |
| under `githubRepoDetails`: `directory` | Path to the Hasura Project directory (typically created by the Hasura CLI) containing Migrations and Metadata. The path should be relative to the project's root directory. |
| under `githubRepoDetails`: `directory` | Path to the Hasura Project directory (typically created by the Hasura CLI) containing Migrations and Metadata. The path should be relative to the project's root directory. |
| under `projectOptions`: `name` | Name of the Preview App. A Hasura Cloud project will be created with the same name. Can contain lowercase characters, numbers and hyphens. |
| under `projectOptions`: `cloud` | The cloud provider to deploy the Preview App on. A Hasura Cloud project will be created in the specified cloud provider. Available: `aws` and `gcp`. |
| under `projectOptions`: `cloud` | The cloud provider to deploy the Preview App on. A Hasura Cloud project will be created in the specified cloud provider. Available: `aws` and `gcp`. |
| under `projectOptions`: `region` | The region within the cloud provider to deploy the Preview App on. A Hasura Cloud project will be created in the specified region. Refer to the Hasura Cloud dashboard for available options. |
| under `projectOptions`: `plan` | Pricing tier of the created Preview App. Available options: `cloud_free` and `cloud_payg` (corresponds to Free Tier and Standard Tier respectively). |
| under `projectOptions`: `envVars` | ENV vars to be set for the created Preview App. |
#### Output Fields
| Argument | Description |
|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `githubPreviewAppJobID` | Job ID of the Preview App creation job. This does not mean the Preview App is created, the ID identifies the job responsible for creating the Preview App. For the status of the Preview App creation, query the [`getPreviewAppCreationStatus` API](/graphql/cloud/api-reference.mdx#api-ref-fetch-preview-app-creation-status). |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `githubPreviewAppJobID` | Job ID of the Preview App creation job. This does not mean the Preview App is created, the ID identifies the job responsible for creating the Preview App. For the status of the Preview App creation, query the [`getPreviewAppCreationStatus` API](/api-reference/cloud-api-reference.mdx#api-ref-fetch-preview-app-creation-status). |
### Fetch Preview App Creation Status {#api-ref-fetch-preview-app-creation-status}
Preview App creation is a multistep process. This query fetches the status of the Preview App creation. The input
`jobID` is the same ID obtained in the output of the
[Create GitHub Preview App](/graphql/cloud/api-reference.mdx#api-ref-create-preview-app) mutation.
[Create GitHub Preview App](/api-reference/cloud-api-reference.mdx#api-ref-create-preview-app) mutation.
```graphql
query getPreviewAppCreationStatus($jobId: uuid!) {
@ -223,6 +221,6 @@ query getPreviewAppCreationStatus($jobId: uuid!) {
#### Input Arguments
| Argument | Description |
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | Job ID of the Preview App creation job. The ID identifies the job responsible for creating the Preview app. This can be obtained from the output of the [`createGitHubPreviewApp` API](/graphql/cloud/api-reference.mdx#api-ref-create-preview-app). |
| Argument | Description |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id` | Job ID of the Preview App creation job. The ID identifies the job responsible for creating the Preview app. This can be obtained from the output of the [`createGitHubPreviewApp` API](/api-reference/cloud-api-reference.mdx#api-ref-create-preview-app). |

View File

@ -66,4 +66,4 @@ i.e. remove it from the list of enabled APIs.
HASURA_GRAPHQL_ENABLED_APIS="graphql,metadata"
```
See [GraphQL Engine server config reference](/graphql/core/deployment/graphql-engine-flags/reference.mdx) for info on setting the above flag/env var.
See [GraphQL Engine server config reference](/deployment/graphql-engine-flags/reference.mdx) for info on setting the above flag/env var.

View File

@ -173,5 +173,5 @@ Microsoft SQL Server backend:
## Disabling Explain API
The Explain API is part of the [Metadata API](/graphql/core/api-reference/metadata-api/index.mdx) and can
The Explain API is part of the [Metadata API](/api-reference/metadata-api/index.mdx) and can
only be disabled by disabling the same.

View File

@ -35,8 +35,8 @@ behaviour, where request errors and internal errors were responded with
The following types of requests can be made using the GraphQL API:
- [Query / Subscription](/graphql/core/api-reference/graphql-api/query.mdx )
- [Mutation](/graphql/core/api-reference/graphql-api/mutation.mdx)
- [Query / Subscription](/api-reference/graphql-api/query.mdx )
- [Mutation](/api-reference/graphql-api/mutation.mdx)
## Batching requests

View File

@ -12,7 +12,6 @@ keywords:
# API Reference - Mutation
## **insert** (upsert) syntax {#insert-upsert-syntax}
```none
@ -26,26 +25,18 @@ mutation [<mutation-name>] {
```
| Key | Required | Schema | Description |
|---------------------|----------|---------------------------------------|-----------------------------------------------------------------|
| ------------------- | -------- | ------------------------------------- | --------------------------------------------------------------- |
| mutation-name | false | Value | Name of mutation for observability |
| mutation-field-name | true | Value | Name of the auto-generated mutation field, e.g. *insert_author* |
| mutation-field-name | true | Value | Name of the auto-generated mutation field, e.g. _insert_author_ |
| input-object | true | [InputObjects](#inputobjects) | Name of the auto-generated mutation field |
| mutation-response | true | [MutationResponse](#mutationresponse) | Object to be returned after mutation succeeds |
| on-conflict | false | [ConflictClause](#conflictclause) | Converts *insert* to *upsert* by handling conflict |
| on-conflict | false | [ConflictClause](#conflictclause) | Converts _insert_ to _upsert_ by handling conflict |
**Example: Insert**
```graphql
mutation insert_article {
insert_article(
objects: [
{
title: "Software is gluttonous",
content: "Something happened in HP",
author_id: 3
}
]
) {
insert_article(objects: [{ title: "Software is gluttonous", content: "Something happened in HP", author_id: 3 }]) {
returning {
id
title
@ -58,17 +49,9 @@ mutation insert_article {
```graphql
mutation upsert_author {
insert_author (
objects: [
{
name: "John",
id:12
}
],
on_conflict: {
constraint: author_name_key,
update_columns: [name, id]
}
insert_author(
objects: [{ name: "John", id: 12 }]
on_conflict: { constraint: author_name_key, update_columns: [name, id] }
) {
affected_rows
}
@ -87,25 +70,19 @@ mutation [<mutation-name>] {
}
```
| Key | Required | Schema | Description |
|---------------------|----------|----------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| mutation-name | false | Value | Name of mutation for observability |
| mutation-field-name | true | Value | Name of the auto-generated mutation field, e.g. *insert_author_one* |
| input-object | true | [InputObject](#inputobject) | Name of the auto-generated mutation field |
| mutation-response | true | [SimpleObject](/graphql/core/api-reference/graphql-api/query.mdx#simpleobject) | Object to be returned after mutation succeeds |
| on-conflict | false | [ConflictClause](#conflictclause) | Converts *insert* to *upsert* by handling conflict |
| Key | Required | Schema | Description |
| ------------------- | -------- | ----------------------------------------------------------------- | ------------------------------------------------------------------- |
| mutation-name | false | Value | Name of mutation for observability |
| mutation-field-name | true | Value | Name of the auto-generated mutation field, e.g. _insert_author_one_ |
| input-object | true | [InputObject](#inputobject) | Name of the auto-generated mutation field |
| mutation-response | true | [SimpleObject](/api-reference/graphql-api/query.mdx#simpleobject) | Object to be returned after mutation succeeds |
| on-conflict | false | [ConflictClause](#conflictclause) | Converts _insert_ to _upsert_ by handling conflict |
**Example: Insert One**
```graphql
mutation insert_article_one {
insert_article_one(
object: {
title: "Software is gluttonous",
content: "Something happened in HP",
author_id: 3
}
) {
insert_article_one(object: { title: "Software is gluttonous", content: "Something happened in HP", author_id: 3 }) {
id
title
}
@ -125,9 +102,9 @@ mutation [<mutation-name>] {
```
| Key | Required | Schema | Description |
|-------------------------|----------|-------------------------------------------|----------------------------------------------------------------------------------------------------------|
| ----------------------- | -------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| mutation-name | false | Value | Name of mutation for observability |
| mutation-field-name | true | Value | Name of the auto-generated update mutation field, e.g. *update_author_by_pk* |
| mutation-field-name | true | Value | Name of the auto-generated update mutation field, e.g. _update_author_by_pk_ |
| pk-columns-argument | true | [pkColumnsArgExp](#pkcolumnsargexp) | Primary key(s) for row(s) to be updated |
| set-argument | false | [setArgExp](#setargexp) | Data to be updated in the table |
| inc-argument | false | [incArgExp](#incargexp) | Integer value to be incremented to Int columns in the table (Negative integers can be used to decrement) |
@ -141,12 +118,7 @@ mutation [<mutation-name>] {
```graphql
mutation update_articles {
update_article_by_pk (
pk_columns: {
id: 1
}
_set: { is_published: true }
) {
update_article_by_pk(pk_columns: { id: 1 }, _set: { is_published: true }) {
id
title
}
@ -166,9 +138,9 @@ mutation [<mutation-name>] {
```
| Key | Required | Schema | Description |
|-------------------------|----------|-------------------------------------------|--------------------------------------------------------------------------|
| ----------------------- | -------- | ----------------------------------------- | ------------------------------------------------------------------------ |
| mutation-name | false | Value | Name of mutation for observability |
| mutation-field-name | true | Value | Name of the auto-generated update mutation field, e.g. *update_author* |
| mutation-field-name | true | Value | Name of the auto-generated update mutation field, e.g. _update_author_ |
| where-argument | true | [whereArgExp](#whereargexp) | Selection criteria for rows to be updated |
| set-argument | false | [setArgExp](#setargexp) | Data to be updated in the table |
| inc-argument | false | [incArgExp](#incargexp) | Integer value to be incremented to Int columns in the table |
@ -182,11 +154,8 @@ mutation [<mutation-name>] {
**Example: Update**
```graphql
mutation update_author{
update_author(
where: {id: {_eq: 3}},
_set: {name: "Jane"}
) {
mutation update_author {
update_author(where: { id: { _eq: 3 } }, _set: { name: "Jane" }) {
affected_rows
}
}
@ -205,17 +174,15 @@ mutation [<mutation-name>] {
```
| Key | Required | Schema | Description |
|---------------------|----------|--------|------------------------------------------------------------------------------|
| ------------------- | -------- | ------ | ---------------------------------------------------------------------------- |
| mutation-name | false | Value | Name of mutation for observability |
| mutation-field-name | true | Value | Name of the auto-generated delete mutation field, e.g. *delete_author_by_pk* |
| mutation-field-name | true | Value | Name of the auto-generated delete mutation field, e.g. _delete_author_by_pk_ |
**Example: Delete by PK**
```graphql
mutation delete_articles {
delete_article_by_pk (
id: 1
) {
delete_article_by_pk(id: 1) {
id
title
}
@ -234,9 +201,9 @@ mutation [<mutation-name>] {
```
| Key | Required | Schema | Description |
|---------------------|----------|---------------------------------------|------------------------------------------------------------------------|
| ------------------- | -------- | ------------------------------------- | ---------------------------------------------------------------------- |
| mutation-name | false | Value | Name of mutation for observability |
| mutation-field-name | true | Value | Name of the auto-generated delete mutation field, e.g. *delete_author* |
| mutation-field-name | true | Value | Name of the auto-generated delete mutation field, e.g. _delete_author_ |
| where-argument | true | [whereArgExp](#whereargexp) | Selection criteria for rows to delete |
| mutation-response | true | [MutationResponse](#mutationresponse) | Object to be returned after mutation succeeds |
@ -244,9 +211,7 @@ mutation [<mutation-name>] {
```graphql
mutation delete_articles {
delete_article(
where: {author: {id: {_eq: 7}}}
) {
delete_article(where: { author: { id: { _eq: 7 } } }) {
affected_rows
returning {
id
@ -257,7 +222,7 @@ mutation delete_articles {
:::info Note
For more examples and details of usage, please see [this](/graphql/core/databases/postgres/mutations/index.mdx).
For more examples and details of usage, please see [this](/mutations/postgres/index.mdx).
:::
@ -362,10 +327,9 @@ object: {
### **on_conflict** argument {#conflictclause}
The conflict clause is used to convert an *insert* mutation to an
*upsert* mutation. *Upsert* respects the table's *update* permissions
before editing an existing row in case of a conflict. Hence the conflict
clause is permitted only if a table has *update* permissions defined.
The conflict clause is used to convert an _insert_ mutation to an _upsert_ mutation. _Upsert_ respects the table's
_update_ permissions before editing an existing row in case of a conflict. Hence the conflict clause is permitted only
if a table has _update_ permissions defined.
```none
on_conflict: {
@ -387,8 +351,7 @@ on_conflict: {
### **pk_columns** argument {#pkcolumnsargexp}
The `pk_columns` argument is used to identify an object by its primary
key columns in *update* mutations.
The `pk_columns` argument is used to identify an object by its primary key columns in _update_ mutations.
```none
pk_columns: {
@ -411,9 +374,10 @@ pk_columns: {
<div className="parsed-literal">
<pre>
<code>
{`where: `}<a href="#boolexp">BoolExp</a>
</code>
<code>
{`where: `}
<a href='#boolexp'>BoolExp</a>
</code>
</pre>
</div>
@ -431,13 +395,17 @@ where: {
<div className="parsed-literal">
<pre>
<code>
<a href="#andexp">AndExp</a>{` | `}
<a href="#orexp">OrExp</a>{` | `}
<a href="#notexp">NotExp</a>{` | `}
<a href="#trueexp">TrueExp</a>{` | `}
<a href="#columnexp">ColumnExp</a>
</code>
<code>
<a href='#andexp'>AndExp</a>
{` | `}
<a href='#orexp'>OrExp</a>
{` | `}
<a href='#notexp'>NotExp</a>
{` | `}
<a href='#trueexp'>TrueExp</a>
{` | `}
<a href='#columnexp'>ColumnExp</a>
</code>
</pre>
</div>
@ -447,11 +415,13 @@ where: {
<div className="parsed-literal">
<pre>
<code>
{`{
_and: [`}<a href="#boolexp">BoolExp</a>{`]
<code>
{`{
_and: [`}
<a href='#boolexp'>BoolExp</a>
{`]
}`}
</code>
</code>
</pre>
</div>
@ -460,7 +430,7 @@ where: {
```graphql
_and: [
{rating: {_gt: 5}},
{rating: {_gt: 5}},
{updated_at: {_gt: "2019-01-01"}}
]
```
@ -470,11 +440,13 @@ _and: [
<div className="parsed-literal">
<pre>
<code>
{`{
_or: [`}<a href="#boolexp">BoolExp</a>{`]
<code>
{`{
_or: [`}
<a href='#boolexp'>BoolExp</a>
{`]
}`}
</code>
</code>
</pre>
</div>
@ -483,7 +455,7 @@ _and: [
```graphql
_or: [
{rating: {_is_null: true}},
{rating: {_is_null: true}},
{rating: {_lt: 4}}
]
```
@ -493,11 +465,13 @@ _or: [
<div className="parsed-literal">
<pre>
<code>
{`{
_not: `}<a href="#boolexp">BoolExp</a>{`
<code>
{`{
_not: `}
<a href='#boolexp'>BoolExp</a>
{`
}`}
</code>
</code>
</pre>
</div>
@ -513,9 +487,7 @@ _not: {
##### TrueExp {#trueexp}
<pre>
<code>
{`{}`}
</code>
<code>{`{}`}</code>
</pre>
**Example**
@ -535,11 +507,13 @@ author(where: {articles: {}})
<div className="parsed-literal">
<pre>
<code>
{`{
field-name: { `}<a href="#operator">Operator</a>{`: Value }
<code>
{`{
field-name: { `}
<a href='#operator'>Operator</a>
{`: Value }
}`}
</code>
</code>
</pre>
</div>

View File

@ -24,7 +24,7 @@ query|subscription [<op-name>] {
```
| Key | Required | Schema | Description |
|----------|----------|-----------------------|---------------------------------------------------------------------------|
| -------- | -------- | --------------------- | ------------------------------------------------------------------------- |
| op-name | false | Value | Name query/subscription for observability |
| object | true | [Object](#object) | Name of the table/object |
| argument | false | [Argument](#argument) | One or more of filter criteria, instructions for sort order or pagination |
@ -33,7 +33,7 @@ query|subscription [<op-name>] {
```graphql
query {
author(where: {articles: {rating: {_gte: 4}}} order_by: {name: asc}) {
author(where: { articles: { rating: { _gte: 4 } } }, order_by: { name: asc }) {
id
name
}
@ -50,9 +50,10 @@ subscription {
}
}
```
:::info Note
For more examples and details of usage, please see [this](/graphql/core/databases/postgres/queries/index.mdx).
For more examples and details of usage, please see [this](/queries/postgres/index.mdx).
:::
@ -69,9 +70,9 @@ query|subscription [<op-name>] {
```
| Key | Required | Schema | Description |
|------------------|----------|--------|--------------------------------------------------------------|
| ---------------- | -------- | ------ | ------------------------------------------------------------ |
| op-name | false | Value | Name query/subscription for observability |
| query-field-name | true | Value | Name of the auto-generated query field, e.g. *article_by_pk* |
| query-field-name | true | Value | Name of the auto-generated query field, e.g. _article_by_pk_ |
**Example: Query by PK**
@ -102,9 +103,11 @@ subscription {
<div className="parsed-literal">
<pre>
<code>
<a href="#simpleobject">SimpleObject</a>{' | '}<a href="#aggregateobject">AggregateObject</a>
</code>
<code>
<a href='#simpleobject'>SimpleObject</a>
{' | '}
<a href='#aggregateobject'>AggregateObject</a>
</code>
</pre>
</div>
@ -125,10 +128,10 @@ object-name {
```
| Key | Required | Schema | Description |
|------|----------|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ---- | -------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| path | false | Value | `path` argument of `json`/`jsonb` follows simple [JSONPath specification](https://github.com/json-path/JsonPath). However, prefix symbol `$.` is optional. |
*Example*
_Example_
```graphql
author {
@ -217,10 +220,10 @@ object-name_aggregate {
}
```
(For more details on aggregate functions, refer to the [Postgres
docs](https://www.postgresql.org/docs/current/functions-aggregate.html#FUNCTIONS-AGGREGATE-STATISTICS-TABLE)).
(For more details on aggregate functions, refer to the
[Postgres docs](https://www.postgresql.org/docs/current/functions-aggregate.html#FUNCTIONS-AGGREGATE-STATISTICS-TABLE)).
*Example*
_Example_
```graphql
author_aggregate {
@ -283,12 +286,15 @@ author_aggregate {
<div className="parsed-literal">
<pre>
<code>
<a href="#distinctonexp">DistinctOnExp</a>{` | `}
<a href="#whereexp">WhereExp</a>{` | `}
<a href="#orderbyexp">OrderByExp</a>{` | `}
<a href="#paginationexp">PaginationExp</a>
</code>
<code>
<a href='#distinctonexp'>DistinctOnExp</a>
{` | `}
<a href='#whereexp'>WhereExp</a>
{` | `}
<a href='#orderbyexp'>OrderByExp</a>
{` | `}
<a href='#paginationexp'>PaginationExp</a>
</code>
</pre>
</div>
@ -298,14 +304,16 @@ author_aggregate {
<div className="parsed-literal">
<pre>
<code>
{`distinct_on: [`}<a href="#tableselectcolumnenum">TableSelectColumnEnum</a>{`]`}
</code>
<code>
{`distinct_on: [`}
<a href='#tableselectcolumnenum'>TableSelectColumnEnum</a>
{`]`}
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {
@ -334,18 +342,19 @@ enum article_select_column {
<div className="parsed-literal">
<pre>
<code>
{`where: `}<a href="#boolexp">BoolExp</a>
</code>
<code>
{`where: `}
<a href='#boolexp'>BoolExp</a>
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {
author(where: {rating: {_gt: 4}}) {
author(where: { rating: { _gt: 4 } }) {
name
articles {
title
@ -359,13 +368,17 @@ query {
<div className="parsed-literal">
<pre>
<code>
<a href="#andexp">AndExp</a>{` | `}
<a href="#orexp">OrExp</a>{` | `}
<a href="#notexp">NotExp</a>{` | `}
<a href="#trueexp">TrueExp</a>{` | `}
<a href="#columnexp">ColumnExp</a>
</code>
<code>
<a href='#andexp'>AndExp</a>
{` | `}
<a href='#orexp'>OrExp</a>
{` | `}
<a href='#notexp'>NotExp</a>
{` | `}
<a href='#trueexp'>TrueExp</a>
{` | `}
<a href='#columnexp'>ColumnExp</a>
</code>
</pre>
</div>
@ -375,21 +388,22 @@ query {
<div className="parsed-literal">
<pre>
<code>
{`{
_and: [`}<a href="#boolexp">BoolExp</a>{`]
<code>
{`{
_and: [`}
<a href='#boolexp'>BoolExp</a>
{`]
}`}
</code>
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {
article(where: {_and: [{rating: {_gt: 4}}, {published_on: {_gt: "2018-01-01"}}]}) {
article(where: { _and: [{ rating: { _gt: 4 } }, { published_on: { _gt: "2018-01-01" } }] }) {
title
content
}
@ -398,8 +412,7 @@ query {
:::info Syntactic sugar
You can simplify an `_and` expression by passing the sub-expressions
separated by a `,`.
You can simplify an `_and` expression by passing the sub-expressions separated by a `,`.
**First example: \_and expression with different fields**
@ -450,20 +463,22 @@ rating: {
<div className="parsed-literal">
<pre>
<code>
{`{
_or: [`}<a href="#boolexp">BoolExp</a>{`]
<code>
{`{
_or: [`}
<a href='#boolexp'>BoolExp</a>
{`]
}`}
</code>
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {
article(where: {_or: [{rating: {_gt: 4}}, {is_published: {_eq: true}}]}) {
article(where: { _or: [{ rating: { _gt: 4 } }, { is_published: { _eq: true } }] }) {
title
content
}
@ -472,13 +487,11 @@ query {
:::info Note
The `_or` operator expects an array of expressions as input. Passing an
object to it will result in the behaviour of the `_and` operator due to
the way [GraphQL list input
coercion](https://graphql.github.io/graphql-spec/June2018/#sec-Type-System.List)
behaves.
The `_or` operator expects an array of expressions as input. Passing an object to it will result in the behaviour of the
`_and` operator due to the way
[GraphQL list input coercion](https://graphql.github.io/graphql-spec/June2018/#sec-Type-System.List) behaves.
*Example:*
_Example:_
```graphql
{
@ -518,20 +531,22 @@ behaves.
<div className="parsed-literal">
<pre>
<code>
{`{
_not: `}<a href="#boolexp">BoolExp</a>{`
<code>
{`{
_not: `}
<a href='#boolexp'>BoolExp</a>
{`
}`}
</code>
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {
article(where: {_not: {title: {_eq: ""}}} ) {
article(where: { _not: { title: { _eq: "" } } }) {
title
content
}
@ -541,16 +556,14 @@ query {
###### TrueExp
<pre>
<code>
{`{}`}
</code>
<code>{`{}`}</code>
</pre>
*Example*
_Example_
```graphql
query {
author(where: {articles: {}}) {
author(where: { articles: {} }) {
name
}
}
@ -567,20 +580,22 @@ query {
<div className="parsed-literal">
<pre>
<code>
{`{
field-name: { `}<a href="#operator">Operator</a>{`: Value }
<code>
{`{
field-name: { `}
<a href='#operator'>Operator</a>
{`: Value }
}`}
</code>
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {
article(where: {title: {_eq: "GraphQL Tutorial"}}) {
article(where: { title: { _eq: "GraphQL Tutorial" } }) {
title
content
}
@ -589,12 +604,12 @@ query {
###### Operator {#operator}
<div id="generic-operators"/>
<div id='generic-operators' />
**Generic operators (all column types except json, jsonb):**
| Operator | PostgreSQL equivalent |
|----------|-----------------------|
| -------- | --------------------- |
| `_eq` | `=` |
| `_neq` | `<>` |
| `_gt` | `>` |
@ -604,17 +619,16 @@ query {
| `_in` | `IN` |
| `_nin` | `NOT IN` |
(For more details, refer to the Postgres docs for [comparison
operators](https://www.postgresql.org/docs/current/functions-comparison.html)
and [list based search
operators](https://www.postgresql.org/docs/current/functions-comparisons.html).)
(For more details, refer to the Postgres docs for
[comparison operators](https://www.postgresql.org/docs/current/functions-comparison.html) and
[list based search operators](https://www.postgresql.org/docs/current/functions-comparisons.html).)
<div id="text-operators"/>
<div id='text-operators' />
**Text related operators:**
| Operator | PostgreSQL equivalent |
|-------------|-----------------------|
| ----------- | --------------------- |
| `_like` | `LIKE` |
| `_nlike` | `NOT LIKE` |
| `_ilike` | `ILIKE` |
@ -626,52 +640,52 @@ operators](https://www.postgresql.org/docs/current/functions-comparisons.html).)
| `_nregex` | `!~` |
| `_niregex` | `!~*` |
(For more details on text related operators, refer to the [Postgres
docs](https://www.postgresql.org/docs/current/functions-matching.html).)
(For more details on text related operators, refer to the
[Postgres docs](https://www.postgresql.org/docs/current/functions-matching.html).)
<div id="null-expression"/>
<div id='null-expression' />
**Checking for NULL values:**
| Operator | PostgreSQL equivalent |
|-----------------------------------------|-----------------------|
| --------------------------------------- | --------------------- |
| `_is_null` (takes true/false as values) | `IS NULL` |
(For more details on the `IS NULL` expression, refer to the [Postgres
docs](https://www.postgresql.org/docs/current/functions-comparison.html).)
(For more details on the `IS NULL` expression, refer to the
[Postgres docs](https://www.postgresql.org/docs/current/functions-comparison.html).)
<div id="type-casting"/>
<div id='type-casting' />
**Type casting:**
| Operator | PostgreSQL equivalent |
|--------------------------------------------------|-----------------------|
| ------------------------------------------------ | --------------------- |
| `_cast` (takes a [CastExp](#castexp) as a value) | `::` |
(For more details on type casting, refer to the [Postgres
docs](https://www.postgresql.org/docs/current/sql-createcast.html).)
(For more details on type casting, refer to the
[Postgres docs](https://www.postgresql.org/docs/current/sql-createcast.html).)
<div id="jsonb-operators"/>
<div id='jsonb-operators' />
**JSONB operators:**
| Operator | PostgreSQL equivalent |
|-----------------|-----------------------|
| --------------- | --------------------- |
| `_contains` | `@>` |
| `_contained_in` | `<@` |
| `_has_key` | `?` |
| `_has_keys_any` | `?!` |
| `_has_keys_all` | `?&` |
(For more details on JSONB operators, refer to the [Postgres
docs](https://www.postgresql.org/docs/current/static/functions-json.html#FUNCTIONS-JSONB-OP-TABLE).)
(For more details on JSONB operators, refer to the
[Postgres docs](https://www.postgresql.org/docs/current/static/functions-json.html#FUNCTIONS-JSONB-OP-TABLE).)
<div id="geometry-operators"/>
<div id='geometry-operators' />
**PostGIS related operators on GEOMETRY columns:**
| Operator | PostGIS equivalent |
|------------------|--------------------------------|
| ---------------- | ------------------------------ |
| `_st_contains` | `ST_Contains(column, input)` |
| `_st_crosses` | `ST_Crosses(column, input)` |
| `_st_equals` | `ST_Equals(column, input)` |
@ -682,42 +696,40 @@ docs](https://www.postgresql.org/docs/current/static/functions-json.html#FUNCTIO
| `_st_d_within` | `ST_DWithin(column, input)` |
(For more details on spatial relationship operators, refer to the
[PostGIS
docs](http://postgis.net/workshops/postgis-intro/spatial_relationships.html).)
[PostGIS docs](http://postgis.net/workshops/postgis-intro/spatial_relationships.html).)
:::info Note
- All operators take a JSON representation of `geometry/geography`
values as input value.
- All operators take a JSON representation of `geometry/geography` values as input value.
- The input value for `_st_d_within` operator is an object:
```
{
field-name : {_st_d_within: {distance: Float, from: Value} }
}
```
- The input value for `_st_d_within` operator is an object:
```
{
field-name : {_st_d_within: {distance: Float, from: Value} }
}
```
:::
<div id="intersect-operators"/>
<div id='intersect-operators' />
**Intersect Operators on RASTER columns:**
| Operator | PostgreSQL equivalent | Input object |
|-----------------------------|-----------------------------------------|---------------------------------------------------------------------|
| --------------------------- | --------------------------------------- | ------------------------------------------------------------------- |
| `_st_intersects_rast` | `ST_Intersects(column, value)` | `{ _st_intersects_rast: raster }` |
| `_st_intersects_nband_geom` | `ST_Intersects(column, nband, geommin)` | `{ _st_intersects_nband_geom: {nband: Integer! geommin: geometry!}` |
| `_st_intersects_geom_nband` | `ST_Intersects(column, geommin, nband)` | `{ _st_intersects_geom_nband: {geommin: geometry! nband: Integer }` |
(For more details on intersect operators on `raster` columns refer to
the [PostGIS docs](https://postgis.net/docs/RT_ST_Intersects.html).)
(For more details on intersect operators on `raster` columns refer to the
[PostGIS docs](https://postgis.net/docs/RT_ST_Intersects.html).)
<div id="ltree-operators"/>
<div id='ltree-operators' />
**ltree operators:**
| Operator | PostgreSQL equivalent |
|---------------------|-----------------------|
| ------------------- | --------------------- |
| `_ancestor` | `@>` |
| `_ancestor_any` | `@>` |
| `_descendant` | `<@` |
@ -726,23 +738,24 @@ the [PostGIS docs](https://postgis.net/docs/RT_ST_Intersects.html).)
| `_matches_any` | `?` |
| `_matches_fulltext` | `@` |
(For more details on operators on `ltree` columns refer to the [Postgres
docs](https://www.postgresql.org/docs/current/ltree.html).)
(For more details on operators on `ltree` columns refer to the
[Postgres docs](https://www.postgresql.org/docs/current/ltree.html).)
###### CastExp {#castexp}
<div className="parsed-literal">
<pre>
<code>
{`{ type-name: {`}<a href="#operator">Operator</a>{`: Value} }`}
</code>
<code>
{`{ type-name: {`}
<a href='#operator'>Operator</a>
{`: Value} }`}
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query MyQuery($coordinate: geography!) {
@ -782,44 +795,44 @@ Currently, only the following type casts are supported:
<div className="parsed-literal">
<pre>
<code>
{`order_by: (`}
<a href="#tableorderby">TableOrderBy</a>
{` | [`}
<a href="#tableorderby">TableOrderBy</a>
{`])`}
</code>
<code>
{`order_by: (`}
<a href='#tableorderby'>TableOrderBy</a>
{` | [`}
<a href='#tableorderby'>TableOrderBy</a>
{`])`}
</code>
</pre>
</div>
*Example 1*
_Example 1_
```graphql
query {
author(order_by: {rating: desc}) {
author(order_by: { rating: desc }) {
name
rating
}
}
```
*Example 2*
_Example 2_
```graphql
query {
article(order_by: [{id: desc}, {author: {id: asc}}]) {
article(order_by: [{ id: desc }, { author: { id: asc } }]) {
title
rating
}
}
```
*Example 3*
_Example 3_
```graphql
query {
article(order_by: [{id: desc}, {author: {id: asc}}]) {
article(order_by: [{ id: desc }, { author: { id: asc } }]) {
title
rating
}
@ -833,18 +846,20 @@ query {
<div className="parsed-literal">
<pre>
<code>
{`{ column: `}<a href="#orderbyenum">OrderByEnum</a>{` }`}
</code>
<code>
{`{ column: `}
<a href='#orderbyenum'>OrderByEnum</a>
{` }`}
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {
article(order_by: {rating: asc}) {
article(order_by: { rating: asc }) {
title
content
}
@ -856,18 +871,20 @@ query {
<div className="parsed-literal">
<pre>
<code>
{`{ relation-name: `}<a href="#tableorderby">TableOrderBy</a>{` }`}
</code>
<code>
{`{ relation-name: `}
<a href='#tableorderby'>TableOrderBy</a>
{` }`}
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {
article(order_by: {author: {rating: desc}}) {
article(order_by: { author: { rating: desc } }) {
title
content
}
@ -879,19 +896,20 @@ query {
<div className="parsed-literal">
<pre>
<code>
{`{ relation-name_aggregate: `}<a href="#aggregateorderby">AggregateOrderBy</a>{` }`}
</code>
<code>
{`{ relation-name_aggregate: `}
<a href='#aggregateorderby'>AggregateOrderBy</a>
{` }`}
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {
author(order_by: {articles_aggregate: {max: {rating: asc}}}) {
author(order_by: { articles_aggregate: { max: { rating: asc } } }) {
name
}
}
@ -904,9 +922,11 @@ Returning scalar values:
<div className="parsed-literal">
<pre>
<code>
{`{ computed-field-name: `}<a href="#orderbyenum">OrderByEnum</a>{` }`}
</code>
<code>
{`{ computed-field-name: `}
<a href='#orderbyenum'>OrderByEnum</a>
{` }`}
</code>
</pre>
</div>
@ -916,9 +936,11 @@ Returning set of table rows:
<div className="parsed-literal">
<pre>
<code>
{`{ computed-field-name: `}<a href="#tableorderby">TableOrderBy</a>{` }`}
</code>
<code>
{`{ computed-field-name: `}
<a href='#tableorderby'>TableOrderBy</a>
{` }`}
</code>
</pre>
</div>
@ -926,9 +948,11 @@ Returning set of table rows:
<div className="parsed-literal">
<pre>
<code>
{`{ computed-field-name_aggregate: `}<a href="#aggregateorderby">AggregateOrderBy</a>{` }`}
</code>
<code>
{`{ computed-field-name_aggregate: `}
<a href='#aggregateorderby'>AggregateOrderBy</a>
{` }`}
</code>
</pre>
</div>
@ -953,23 +977,23 @@ input article_order_by {
<div className="parsed-literal">
<pre>
<code>
{`{ computed-field-name: `}<a href="#orderbyenum">OrderByEnum</a>{` }`}
</code>
<code>
{`{ computed-field-name: `}
<a href='#orderbyenum'>OrderByEnum</a>
{` }`}
</code>
</pre>
</div>
*Example*
_Example_
Consider a table `student` contains integer columns for course subjects
to store marks. A computed field with the name `total_marks` defined to
calculate sum of all subject marks. We need to fetch `student` rows
sorted by `total_marks`.
Consider a table `student` contains integer columns for course subjects to store marks. A computed field with the name
`total_marks` defined to calculate sum of all subject marks. We need to fetch `student` rows sorted by `total_marks`.
```graphql
query {
student(order_by: {total_marks: desc}){
student(order_by: { total_marks: desc }) {
id
name
total_marks
@ -979,31 +1003,31 @@ query {
**For computed fields returning table row type**
Computed fields returning set of table rows can be used to sort the
query by their aggregate fields.
Computed fields returning set of table rows can be used to sort the query by their aggregate fields.
<div className="parsed-literal">
<pre>
<code>
{`{ computed-field-name_aggregate: `}<a href="#aggregateorderby">AggregateOrderBy</a>{` }`}
</code>
<code>
{`{ computed-field-name_aggregate: `}
<a href='#aggregateorderby'>AggregateOrderBy</a>
{` }`}
</code>
</pre>
</div>
*Example*
_Example_
A computed field `get_articles` is defined on the `author` table which
returns set of `article` table rows. Fetch authors sorted by the count
of their articles.
A computed field `get_articles` is defined on the `author` table which returns set of `article` table rows. Fetch
authors sorted by the count of their articles.
```graphql
query {
author(order_by: {get_articles_aggregate: {count: desc}}){
author(order_by: { get_articles_aggregate: { count: desc } }) {
id
name
get_articles{
get_articles {
id
title
content
@ -1039,18 +1063,20 @@ enum order_by {
<div className="parsed-literal">
<pre>
<code>
{`{ count: `}<a href="#orderbyenum">OrderByEnum</a>{` }`}
</code>
<code>
{`{ count: `}
<a href='#orderbyenum'>OrderByEnum</a>
{` }`}
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {
author(order_by: {articles_aggregate: {count: desc}}) {
author(order_by: { articles_aggregate: { count: desc } }) {
name
}
}
@ -1061,34 +1087,38 @@ query {
<div className="parsed-literal">
<pre>
<code>
{`{ op_name: `}<a href="#tableaggoporderby">TableAggOpOrderBy</a>{` }`}
</code>
<code>
{`{ op_name: `}
<a href='#tableaggoporderby'>TableAggOpOrderBy</a>
{` }`}
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {
author (order_by: {articles_aggregate: {sum: {id: desc}}}) {
author(order_by: { articles_aggregate: { sum: { id: desc } } }) {
id
}
}
```
Available operations are `sum`, `avg`, `max`, `min`, `stddev`,
`stddev_samp`, `stddev_pop`, `variance`, `var_samp` and `var_pop`.
Available operations are `sum`, `avg`, `max`, `min`, `stddev`, `stddev_samp`, `stddev_pop`, `variance`, `var_samp` and
`var_pop`.
###### TableAggOpOrderBy
<div className="parsed-literal">
<pre>
<code>
{`{ column: `}<a href="#orderbyenum">OrderByEnum</a>{` }`}
</code>
<code>
{`{ column: `}
<a href='#orderbyenum'>OrderByEnum</a>
{` }`}
</code>
</pre>
</div>
@ -1098,15 +1128,15 @@ Available operations are `sum`, `avg`, `max`, `min`, `stddev`,
<div className="parsed-literal">
<pre>
<code>
{`limit: Integer
<code>
{`limit: Integer
[offset: Integer]`}
</code>
</code>
</pre>
</div>
*Example*
_Example_
```graphql
query {

View File

@ -44,7 +44,7 @@ be returned:
:::info Note
If there are metadata inconsistencies, you should use the Hasura console
or the [get_inconsistent_metadata](/graphql/core/api-reference/metadata-api/manage-metadata.mdx#metadata-get-inconsistent-metadata) metadata API to find out
or the [get_inconsistent_metadata](/api-reference/metadata-api/manage-metadata.mdx#metadata-get-inconsistent-metadata) metadata API to find out
what the inconsistent objects are and resolve them.
:::

View File

@ -0,0 +1,106 @@
---
description: Hasura API reference
keywords:
- hasura
- docs
- API
- API reference
slug: index
---
# API Reference
## Available APIs
| API | Endpoint | Access |
| ------------------------------ | ----------------------------------- | ---------------- |
| GraphQL | [/v1/graphql](#graphql-api) | Permission rules |
| Relay | [/v1beta1/relay](#relay-api) | Permission rules |
| Legacy GraphQL | [/v1alpha1/graphql](#graphql-api) | Permission rules |
| Schema _(> v2.0)_ | [/v2/query](#schema-api) | Admin only |
| Metadata _(> v2.0)_ | [/v1/metadata](#metadata-api) | Admin only |
| Schema/Metadata _(deprecated)_ | [/v1/query](#schema-metadata-api) | Admin only |
| Restified GQL | [/api/rest](#restified-graphql-api) | GQL REST Routes |
| Version | [/v1/version](#version-api) | Public |
| Health | [/healthz](#health-check-api) | Public |
| PG Dump | [/v1alpha1/pg_dump](#pg-dump-api) | Admin only |
| Config | [/v1alpha1/config](#config-api) | Admin only |
| Explain | [/v1/graphql/explain](#explain-api) | Admin only |
### GraphQL API {#graphql-api}
All GraphQL requests for queries, subscriptions and mutations are made to the GraphQL API.
See details at [GraphQL API Reference](/api-reference/graphql-api/index.mdx).
### Relay API {#relay-api}
Hasura exposes a Relay schema for GraphQL requests for queries, subscriptions and mutations.
See docs at [Postgres: Relay schema](/schema/postgres/relay-schema.mdx).
See details at [Relay GraphQL API Reference](/api-reference/relay-graphql-api/index.mdx).
### Schema API {#schema-api}
Hasura exposes a schema API for directly executing SQL on the underlying Postgres.
This is primarily intended to be used as an `admin` API to manage the Hasura schema.
See details at [Schema API Reference](/api-reference/schema-api/index.mdx).
### Metadata API {#metadata-api}
Hasura exposes a metadata API for managing metadata.
This is primarily intended to be used as an `admin` API to manage the Hasura metadata.
See details at [Metadata API Reference](/api-reference/metadata-api/index.mdx).
### Schema / metadata API (Deprecated) {#schema-metadata-api}
Hasura exposes a schema / metadata API for managing metadata for permissions/relationships or for directly executing SQL
on the underlying Postgres.
This is primarily intended to be used as an `admin` API to manage the Hasura schema and metadata.
See details at [Schema / Metadata API Reference (Deprecated)](/api-reference/schema-metadata-api/index.mdx).
### RESTified GraphQL API {#restified-graphql-api}
Hasura allows saved GraphQL queries and mutations to be accesed through a REST interface.
See details at [RESTified GraphQL Endpoints API Reference](/api-reference/restified.mdx).
### Version API {#version-api}
The `/v1/version` is a public endpoint that responds with the current server version in JSON format.
See details at [Version API Reference](/api-reference/version.mdx).
### Health check API {#health-check-api}
The `/healthz` is a public endpoint that returns the server health status. There's also `/hasura/healthz` available as
an alternative, which mirrors `/healthz` completely.
See details at [Health check API Reference](/api-reference/health.mdx).
### pg_dump API {#pg-dump-api}
The `/v1alpha1/pg_dump` is an admin-only endpoint that can be used to execute `pg_dump` on the Postgres instance
connected to Hasura. The `pg_dump` CLI tool's argument can be passed as a POST request body to the API and the response
is sent back to the client.
See details at [PG Dump API Reference](/api-reference/pgdump.mdx).
### Config API {#config-api}
`v1alpha1/config` is an admin-only endpoint to get the current server configuration.
See details at [Config API Reference](/api-reference/config.mdx).
### Explain API {#explain-api}
`v1/graphql/explain` returns the Postgres plan for a query or subscription based on the defined permissions.
See details at [Explain API Reference](/api-reference/explain.mdx).

View File

@ -19,7 +19,7 @@ keywords:
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -64,14 +64,14 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------------|--------------------------|
| name | true | [ActionName](/graphql/core/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| definition | true | [ActionDefinition](/graphql/core/api-reference/syntax-defs.mdx#actiondefinition) | Definition of the action |
| name | true | [ActionName](/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| definition | true | [ActionDefinition](/api-reference/syntax-defs.mdx#actiondefinition) | Definition of the action |
| comment | false | text | comment |
:::info Note
The `GraphQL Types` used in creating an action must be defined before
via [Custom Types](/graphql/core/api-reference/metadata-api/custom-types.mdx)
via [Custom Types](/api-reference/metadata-api/custom-types.mdx)
:::
@ -100,7 +100,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
| name | true | [ActionName](/graphql/core/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| name | true | [ActionName](/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| clear_data | false | boolean | If set to `true` and action kind is `asynchronous`, related data is deleted from catalog. (default: `true`) |
## update_action {#metadata-update-action}
@ -142,8 +142,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------------|-----------------------------------------|
| name | true | [ActionName](/graphql/core/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| definition | true | [ActionDefinition](/graphql/core/api-reference/syntax-defs.mdx#actiondefinition) | Definition of the action to be replaced |
| name | true | [ActionName](/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| definition | true | [ActionDefinition](/api-reference/syntax-defs.mdx#actiondefinition) | Definition of the action to be replaced |
## create_action_permission {#metadata-create-action-permission}
@ -168,8 +168,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------|--------------------|
| action | true | [ActionName](/graphql/core/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Name of the role |
| action | true | [ActionName](/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Name of the role |
| comment | false | text | comment |
## drop_action_permission {#metadata-drop-action-permission}
@ -194,5 +194,5 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------|----------|-----------------------------------------------------------------------|--------------------|
| name | true | [ActionName](/graphql/core/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Name of the role |
| name | true | [ActionName](/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Name of the role |

View File

@ -23,7 +23,7 @@ or [table row types](https://www.postgresql.org/docs/current/rowtypes.mdx#ROWTYP
:::info Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -65,11 +65,11 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [ComputedFieldName](/graphql/core/api-reference/syntax-defs.mdx#computedfieldname) | Name of the new computed field |
| definition | true | [ComputedFieldDefinition](/graphql/core/api-reference/syntax-defs.mdx#computedfielddefinition) | The computed field definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [ComputedFieldName](/api-reference/syntax-defs.mdx#computedfieldname) | Name of the new computed field |
| definition | true | [ComputedFieldDefinition](/api-reference/syntax-defs.mdx#computedfielddefinition) | The computed field definition |
| comment | false | `String` | Customise the description shown in GraphQL introspection. If null or omitted then if a comment exists on the database function, it is used as the description, and if not, an autogenerated description is used instead. |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_drop_computed_field {#metadata-pg-drop-computed-field}
@ -104,10 +104,10 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [ComputedFieldName](/graphql/core/api-reference/syntax-defs.mdx#computedfieldname) | Name of the computed field |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [ComputedFieldName](/api-reference/syntax-defs.mdx#computedfieldname) | Name of the computed field |
| cascade | false | Boolean | When set to `true`, all the dependent items (if any) on this computed fields are also dropped |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## bigquery_add_computed_field {#metadata-bigquery-add-computed-field}
@ -153,10 +153,10 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#bigquerytablename) | Name of the table |
| source | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table |
| name | true | [ComputedFieldName](/graphql/core/api-reference/syntax-defs.mdx#computedfieldname) | Name of the computed field |
| definition | true | [ComputedFieldDefinition](/graphql/core/api-reference/syntax-defs.mdx#bigquerycomputedfielddefinition) | The computed field definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#bigquerytablename) | Name of the table |
| source | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table |
| name | true | [ComputedFieldName](/api-reference/syntax-defs.mdx#computedfieldname) | Name of the computed field |
| definition | true | [ComputedFieldDefinition](/api-reference/syntax-defs.mdx#bigquerycomputedfielddefinition) | The computed field definition |
| comment | false | `String` | Customise the description shown in GraphQL introspection. If null or omitted then if a comment exists on the database function, it is used as the description, and if not, an autogenerated description is used instead. |
## bigquery_drop_computed_field {#metadata-bigquery-drop-computed-field}
@ -192,7 +192,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#bigquerytablename) | Name of the table |
| source | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table |
| name | true | [ComputedFieldName](/graphql/core/api-reference/syntax-defs.mdx#computedfieldname) | Name of the computed field |
| table | true | [TableName](/api-reference/syntax-defs.mdx#bigquerytablename) | Name of the table |
| source | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table |
| name | true | [ComputedFieldName](/api-reference/syntax-defs.mdx#computedfieldname) | Name of the computed field |
| cascade | false | Boolean | When set to `true`, all the dependent items (if any) on this computed fields are also dropped |

View File

@ -22,7 +22,7 @@ querying/mutating/subscribing data over the GraphQL API.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -31,7 +31,7 @@ replaces the older [schema/metadata API](/graphql/core/api-reference/schema-meta
`pg_track_function` is used to add a custom SQL function to the GraphQL
schema. It supports more configuration options than v1, and also
supports tracking functions as mutations. Also refer a note
[here](/graphql/core/api-reference/syntax-defs.mdx#function-req-note).
[here](/api-reference/syntax-defs.mdx#function-req-note).
Track an SQL function called `search_articles` with a Hasura session argument:
@ -105,9 +105,9 @@ default).
| Key | Required | Schema | Description |
|---------------|----------|---------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| function | true | [FunctionName](/graphql/core/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |
| configuration | false | [Function Configuration](/graphql/core/api-reference/syntax-defs.mdx#function-configuration) | Configuration for the SQL function |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the function (default: `default`) |
| function | true | [FunctionName](/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |
| configuration | false | [Function Configuration](/api-reference/syntax-defs.mdx#function-configuration) | Configuration for the SQL function |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the function (default: `default`) |
| comment | false | String | Comment for the function. This comment would replace the auto-generated comment for the function field in the GraphQL schema. |
## pg_untrack_function {#metadata-pg-untrack-function}
@ -137,8 +137,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|----------|----------|-------------------------------|------------------------------------------------------------------|
| function | true | [FunctionName](/graphql/core/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the function (default: `default`) |
| function | true | [FunctionName](/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the function (default: `default`) |
## pg_set_function_customization {#metadata-pg-set-function-customization}
@ -172,9 +172,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------|----------|---------------------------------------------------|------------------------------------------------------------------|
| function | true | [FunctionName](/graphql/core/api-reference/syntax-defs.mdx#functionname) | Name of the function |
| configuration | false | [Function Configuration](/graphql/core/api-reference/syntax-defs.mdx#function-configuration) | Configuration for the function |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the function (default: `default`) |
| function | true | [FunctionName](/api-reference/syntax-defs.mdx#functionname) | Name of the function |
| configuration | false | [Function Configuration](/api-reference/syntax-defs.mdx#function-configuration) | Configuration for the function |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the function (default: `default`) |
## pg_create_function_permission {#metadata-pg-create-function-permission}
@ -201,8 +201,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|----------|----------|-------------------------------|------------------------------------------------------------------|
| function | true | [FunctionName](/graphql/core/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Name of the role |
| function | true | [FunctionName](/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Name of the role |
| source | false | Text | Name of the source database of the function (default: `default`) |
## pg_drop_function_permission {#metadata-pg-drop-function-permission}
@ -228,6 +228,6 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|----------|----------|-------------------------------|------------------------------------------------------------------|
| function | true | [FunctionName](/graphql/core/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Name of the role |
| function | true | [FunctionName](/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Name of the role |
| source | false | Text | Name of the source database of the function (default: `default`) |

View File

@ -15,12 +15,12 @@ keywords:
## Introduction
**Custom Types** are user-defined GraphQL types which help to define
[Actions](/graphql/core/api-reference/metadata-api/actions.mdx).
[Actions](/api-reference/metadata-api/actions.mdx).
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -83,7 +83,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------|----------|------------------------------------------------------------------------------------------|-------------------------------|
| input_objects | false | Array of [InputObjectType](/graphql/core/api-reference/syntax-defs.mdx#inputobjecttype) | Set of GraphQL `Input Object` |
| objects | false | Array of [ObjectType](/graphql/core/api-reference/syntax-defs.mdx#objecttype) | Set of GraphQL `Object` |
| scalars | false | Array of [ScalarType](/graphql/core/api-reference/syntax-defs.mdx#scalartype) | Set of GraphQL `Scalar` |
| enums | false | Array of [EnumType](/graphql/core/api-reference/syntax-defs.mdx#enumtype) | Set of GraphQL `Enum` |
| input_objects | false | Array of [InputObjectType](/api-reference/syntax-defs.mdx#inputobjecttype) | Set of GraphQL `Input Object` |
| objects | false | Array of [ObjectType](/api-reference/syntax-defs.mdx#objecttype) | Set of GraphQL `Object` |
| scalars | false | Array of [ScalarType](/api-reference/syntax-defs.mdx#scalartype) | Set of GraphQL `Scalar` |
| enums | false | Array of [EnumType](/api-reference/syntax-defs.mdx#enumtype) | Set of GraphQL `Enum` |

View File

@ -20,7 +20,7 @@ configured webhook.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -74,20 +74,20 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| table | true | [QualifiedTable](/graphql/core/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| table | true | [QualifiedTable](/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| webhook | false | String | Full url of webhook (\*) |
| webhook_from_env | false | String | Environment variable name of webhook (must exist at boot time) (\*) |
| insert | false | [OperationSpec](/graphql/core/api-reference/syntax-defs.mdx#operationspec) | Specification for insert operation |
| update | false | [OperationSpec](/graphql/core/api-reference/syntax-defs.mdx#operationspec) | Specification for update operation |
| delete | false | [OperationSpec](/graphql/core/api-reference/syntax-defs.mdx#operationspec) | Specification for delete operation |
| headers | false | [ [HeaderFromValue](/graphql/core/api-reference/syntax-defs.mdx#headerfromvalue) \| [HeaderFromEnv](/graphql/core/api-reference/syntax-defs.mdx#headerfromenv) ] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConf](/graphql/core/api-reference/syntax-defs.mdx#retryconf) | Retry configuration if event delivery fails |
| insert | false | [OperationSpec](/api-reference/syntax-defs.mdx#operationspec) | Specification for insert operation |
| update | false | [OperationSpec](/api-reference/syntax-defs.mdx#operationspec) | Specification for update operation |
| delete | false | [OperationSpec](/api-reference/syntax-defs.mdx#operationspec) | Specification for delete operation |
| headers | false | [ [HeaderFromValue](/api-reference/syntax-defs.mdx#headerfromvalue) \| [HeaderFromEnv](/api-reference/syntax-defs.mdx#headerfromenv) ] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConf](/api-reference/syntax-defs.mdx#retryconf) | Retry configuration if event delivery fails |
| replace | false | Boolean | If set to true, the event trigger is replaced with the new definition |
| enable_manual | false | Boolean | If set to true, the event trigger can be invoked manually |
| request_transform | false | [RequestTransformation](/graphql/core/api-reference/syntax-defs.mdx#requesttransformation) | Attaches a Request Transformation to the Event Trigger. |
| response_transform | false | [ResponseTransformation](/graphql/core/api-reference/syntax-defs.mdx#responsetransformation) | Attaches a Request Transformation to the Event Trigger. |
| request_transform | false | [RequestTransformation](/api-reference/syntax-defs.mdx#requesttransformation) | Attaches a Request Transformation to the Event Trigger. |
| response_transform | false | [ResponseTransformation](/api-reference/syntax-defs.mdx#responsetransformation) | Attaches a Request Transformation to the Event Trigger. |
(\*) Either `webhook` or `webhook_from_env` are required.
@ -113,8 +113,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------|----------|------------------------------------------------------------------------|-----------------------------------------------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the trigger (default: `default`) |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the trigger (default: `default`) |
## pg_redeliver_event {#metadata-pg-redeliver-event}
@ -166,9 +166,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|------------------------------------------------------------------------|-----------------------------------------------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| payload | true | JSON | Some JSON payload to send to trigger |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the trigger (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the trigger (default: `default`) |
--------------------
@ -225,20 +225,20 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| table | true | [QualifiedTable](/graphql/core/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| table | true | [QualifiedTable](/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| webhook | false | String | Full url of webhook (\*) |
| webhook_from_env | false | String | Environment variable name of webhook (must exist at boot time) (\*) |
| insert | false | [OperationSpec](/graphql/core/api-reference/syntax-defs.mdx#operationspec) | Specification for insert operation |
| update | false | [OperationSpec](/graphql/core/api-reference/syntax-defs.mdx#operationspec) | Specification for update operation |
| delete | false | [OperationSpec](/graphql/core/api-reference/syntax-defs.mdx#operationspec) | Specification for delete operation |
| headers | false | [ [HeaderFromValue](/graphql/core/api-reference/syntax-defs.mdx#headerfromvalue) \| [HeaderFromEnv](/graphql/core/api-reference/syntax-defs.mdx#headerfromenv) ] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConf](/graphql/core/api-reference/syntax-defs.mdx#retryconf) | Retry configuration if event delivery fails |
| insert | false | [OperationSpec](/api-reference/syntax-defs.mdx#operationspec) | Specification for insert operation |
| update | false | [OperationSpec](/api-reference/syntax-defs.mdx#operationspec) | Specification for update operation |
| delete | false | [OperationSpec](/api-reference/syntax-defs.mdx#operationspec) | Specification for delete operation |
| headers | false | [ [HeaderFromValue](/api-reference/syntax-defs.mdx#headerfromvalue) \| [HeaderFromEnv](/api-reference/syntax-defs.mdx#headerfromenv) ] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConf](/api-reference/syntax-defs.mdx#retryconf) | Retry configuration if event delivery fails |
| replace | false | Boolean | If set to true, the event trigger is replaced with the new definition |
| enable_manual | false | Boolean | If set to true, the event trigger can be invoked manually |
| request_transform | false | [RequestTransformation](/graphql/core/api-reference/syntax-defs.mdx#requesttransformation) | Attaches a Request Transformation to the Event Trigger. |
| response_transform | false | [ResponseTransformation](/graphql/core/api-reference/syntax-defs.mdx#responsetransformation) | Attaches a Request Transformation to the Event Trigger. |
| request_transform | false | [RequestTransformation](/api-reference/syntax-defs.mdx#requesttransformation) | Attaches a Request Transformation to the Event Trigger. |
| response_transform | false | [ResponseTransformation](/api-reference/syntax-defs.mdx#responsetransformation) | Attaches a Request Transformation to the Event Trigger. |
(\*) Either `webhook` or `webhook_from_env` are required.
@ -264,8 +264,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------|----------|------------------------------------------------------------------------|-----------------------------------------------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the trigger (default: `default`) |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the trigger (default: `default`) |
## mssql_redeliver_event {#metadata-mssql-redeliver-event}
@ -317,6 +317,6 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|------------------------------------------------------------------------|-----------------------------------------------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| payload | true | JSON | Some JSON payload to send to trigger |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the trigger (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the trigger (default: `default`) |

View File

@ -0,0 +1,254 @@
---
description: Hasura metadata API reference
keywords:
- hasura
- docs
- metadata API
- API reference
slug: index
---
# Metadata API Reference
## Introduction
The metadata API is primarily intended to be used as an `admin` API to
manage the Hasura metadata.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
## Endpoint
All requests are `POST` requests to the `/v1/metadata` endpoint.
## Request structure
```http
POST /v1/metadata HTTP/1.1
{
"type": <query-type>,
"version": <Integer> (optional),
"resource_version": <Integer> (optional),
"args": <args-object>
}
```
The structure of args depends on the type and version.
### Request body
<div className="parsed-literal">
<pre>
<code>
<a href="#metadata-query">Query</a>
</code>
</pre>
</div>
#### Query {#metadata-query}
| Key | Required | Schema | Description |
|------------------|----------|------------|----------------------------------------------------------------|
| type | true | String | Type of the query |
| resource_version | false | Integer | Version of the resource that you are targeting for replacement |
| args | true | JSON Value | The arguments to the query |
| version | false | Integer | Version of the API (inferred by args structure) |
## Request types
The various types of queries are listed in the following table:
| `type` | `args` | `version` | Synopsis |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|------------------------------------------------------------------------|
| **bulk** | [Query](#metadata-query) array | 1 | Execute multiple operations in a single query |
| [pg_add_source](/api-reference/metadata-api/source.mdx#metadata-pg-add-source) | [pg_add_source_args](/api-reference/metadata-api/source.mdx#metadata-pg-add-source-syntax) | 1 | Add a Postgres database |
| [pg_drop_source](/api-reference/metadata-api/source.mdx#metadata-pg-drop-source) | [pg_drop_source_args](/api-reference/metadata-api/source.mdx#metadata-pg-drop-source-syntax) | 1 | Remove a Postgres database |
| [pg_track_table](/api-reference/metadata-api/table-view.mdx#metadata-pg-track-table) | [pg_track_table_args](/api-reference/metadata-api/table-view.mdx#metadata-pg-track-table-syntax) | 1 | Add a Postgres table/view with configuration |
| [pg_untrack_table](/api-reference/metadata-api/table-view.mdx#metadata-pg-untrack-table) | [pg_untrack_table_args](/api-reference/metadata-api/table-view.mdx#metadata-pg-untrack-table-syntax) | 1 | Remove a Postgres table/view |
| [pg_update_source](/api-reference/metadata-api/source.mdx#metadata-pg-update-source) | [pg_update_source_args](/api-reference/metadata-api/source.mdx#metadata-pg-update-source-syntax) | 1 | Update a Postgres database |
| [pg_set_table_customization](/api-reference/metadata-api/table-view.mdx#metadata-pg-set-table-customization) | [pg_set_table_customization_args](/api-reference/metadata-api/table-view.mdx#metadata-pg-set-table-customization-syntax) | 1 | Set table customization of an already tracked Postgres table |
| [pg_set_table_is_enum](/api-reference/metadata-api/table-view.mdx#metadata-pg-set-table-is-enum) | [pg_set_table_is_enum_args](/api-reference/metadata-api/table-view.mdx#metadata-pg-set-table-is-enum-syntax) | 1 | Set a tracked Postgres table as an enum table |
| [pg_track_function](/api-reference/metadata-api/custom-functions.mdx#metadata-pg-track-function) | [pg_track_function_args](/api-reference/metadata-api/custom-functions.mdx#metadata-pg-track-function-syntax) | 1 | Add a Postgres SQL function with configuration |
| [pg_untrack_function](/api-reference/metadata-api/custom-functions.mdx#metadata-pg-untrack-function) | [pg_untrack_function_args](/api-reference/metadata-api/custom-functions.mdx#metadata-pg-untrack-function-syntax) | 1 | Remove a Postgres SQL function |
| [pg_set_function_customization](/api-reference/metadata-api/custom-functions.mdx#metadata-pg-set-function-customization) | [pg_set_function_customization_args](/api-reference/metadata-api/custom-functions.mdx#metadata-pg-set-function-customization-syntax) | 1 | Set function customization of an already tracked Postgres function |
| [pg_create_function_permission](/api-reference/metadata-api/custom-functions.mdx#metadata-pg-create-function-permission) | [pg_create_function_permission_args](/api-reference/metadata-api/custom-functions.mdx#metadata-pg-create-function-permission-syntax) | 1 | Create a Postgres function permission |
| [pg_drop_function_permission](/api-reference/metadata-api/custom-functions.mdx#metadata-pg-drop-function-permission) | [pg_drop_function_permission_args](/api-reference/metadata-api/custom-functions.mdx#metadata-pg-drop-function-permission-syntax) | 1 | Drop an existing Postgres function permission |
| [pg_create_object_relationship](/api-reference/metadata-api/relationship.mdx#metadata-pg-create-object-relationship) | [pg_create_object_relationship_args](/api-reference/metadata-api/relationship.mdx#metadata-pg-create-object-relationship-syntax) | 1 | Define a new object relationship between Postgres tables/views |
| [pg_create_array_relationship](/api-reference/metadata-api/relationship.mdx#metadata-pg-create-array-relationship) | [pg_create_array_relationship_args](/api-reference/metadata-api/relationship.mdx#metadata-pg-create-array-relationship-syntax) | 1 | Define a new array relationship between Postgres tables/views |
| [pg_drop_relationship](/api-reference/metadata-api/relationship.mdx#metadata-pg-drop-relationship) | [pg_drop_relationship_args](/api-reference/metadata-api/relationship.mdx#metadata-pg-drop-relationship-syntax) | 1 | Drop an existing Postgres relationship |
| [pg_rename_relationship](/api-reference/metadata-api/relationship.mdx#metadata-pg-rename-relationship) | [pg_rename_relationship_args](/api-reference/metadata-api/relationship.mdx#metadata-pg-rename-relationship-syntax) | 1 | Modify name of an existing Postgres relationship |
| [pg_set_relationship_comment](/api-reference/metadata-api/relationship.mdx#metadata-pg-set-relationship-comment) | [pg_set_relationship_comment_args](/api-reference/metadata-api/relationship.mdx#metadata-pg-set-relationship-comment-syntax) | 1 | Set comment on an existing Postgres relationship |
| [pg_add_computed_field](/api-reference/metadata-api/computed-field.mdx#metadata-pg-add-computed-field) | [pg_add_computed_field_args](/api-reference/metadata-api/computed-field.mdx#metadata-pg-add-computed-field-syntax) | 1 | Add a computed field to a Postgres table/view |
| [pg_drop_computed_field](/api-reference/metadata-api/computed-field.mdx#metadata-pg-drop-computed-field) | [pg_drop_computed_field_args](/api-reference/metadata-api/computed-field.mdx#metadata-pg-drop-computed-field-syntax) | 1 | Drop a Postgres computed field |
| [pg_create_insert_permission](/api-reference/metadata-api/permission.mdx#metadata-pg-create-insert-permission) | [pg_create_insert_permission_args](/api-reference/metadata-api/permission.mdx#metadata-pg-create-insert-permission-syntax) | 1 | Specify insert permission for a Postgres table/view |
| [pg_drop_insert_permission](/api-reference/metadata-api/permission.mdx#metadata-pg-drop-insert-permission) | [pg_drop_insert_permission_args](/api-reference/metadata-api/permission.mdx#metadata-pg-drop-insert-permission-syntax) | 1 | Remove existing insert permission for a Postgres table/view |
| [pg_create_select_permission](/api-reference/metadata-api/permission.mdx#metadata-pg-create-select-permission) | [pg_create_select_permission_args](/api-reference/metadata-api/permission.mdx#metadata-pg-create-select-permission-syntax) | 1 | Specify select permission for a Postgres table/view |
| [pg_drop_select_permission](/api-reference/metadata-api/permission.mdx#metadata-pg-drop-select-permission) | [pg_drop_select_permission_args](/api-reference/metadata-api/permission.mdx#metadata-pg-drop-select-permission-syntax) | 1 | Remove existing select permission for a Postgres table/view |
| [pg_create_update_permission](/api-reference/metadata-api/permission.mdx#metadata-pg-create-update-permission) | [pg_create_update_permission_args](/api-reference/metadata-api/permission.mdx#metadata-pg-create-update-permission-syntax) | 1 | Specify update permission for a Postgres table/view |
| [pg_drop_update_permission](/api-reference/metadata-api/permission.mdx#metadata-pg-drop-update-permission) | [pg_drop_update_permission_args](/api-reference/metadata-api/permission.mdx#metadata-pg-drop-update-permission-syntax) | 1 | Remove existing update permission for a Postgres table/view |
| [pg_create_delete_permission](/api-reference/metadata-api/permission.mdx#metadata-pg-create-delete-permission) | [pg_create_delete_permission_args](/api-reference/metadata-api/permission.mdx#metadata-pg-create-delete-permission-syntax) | 1 | Specify delete permission for a Postgres table/view |
| [pg_drop_delete_permission](/api-reference/metadata-api/permission.mdx#metadata-pg-drop-delete-permission) | [pg_drop_delete_permission_args](/api-reference/metadata-api/permission.mdx#metadata-pg-drop-delete-permission-syntax) | 1 | Remove existing delete permission for a Postgres table/view |
| [pg_set_permission_comment](/api-reference/metadata-api/permission.mdx#metadata-pg-set-permission-comment) | [pg_set_permission_comment_args](/api-reference/metadata-api/permission.mdx#metadata-pg-set-permission-comment-syntax) | 1 | Set comment on an existing permission for a Postgres table/view |
| [pg_create_event_trigger](/api-reference/metadata-api/event-triggers.mdx#metadata-pg-create-event-trigger) | [pg_create_event_trigger_args](/api-reference/metadata-api/event-triggers.mdx#metadata-pg-create-event-trigger-syntax) | 1 | Create or replace an event trigger on a Postgres table |
| [pg_delete_event_trigger](/api-reference/metadata-api/event-triggers.mdx#metadata-pg-delete-event-trigger) | [pg_delete_event_trigger_args](/api-reference/metadata-api/event-triggers.mdx#metadata-pg-delete-event-trigger-syntax) | 1 | Delete an existing event trigger on a Postgres table |
| [pg_redeliver_event](/api-reference/metadata-api/event-triggers.mdx#metadata-pg-redeliver-event) | [pg_redeliver_event_args](/api-reference/metadata-api/event-triggers.mdx#metadata-pg-redeliver-event-syntax) | 1 | Redeliver an existing event on a Postgres table |
| [pg_invoke_event_trigger](/api-reference/metadata-api/event-triggers.mdx#metadata-pg-invoke-event-trigger) | [pg_invoke_event_trigger_args](/api-reference/metadata-api/event-triggers.mdx#metadata-pg-invoke-event-trigger-syntax) | 1 | Invoke a trigger with custom payload on a Postgres table |
| [bigquery_track_table](/api-reference/metadata-api/table-view.mdx#metadata-bigquery-track-table) | [bigquery_track_table_args](/api-reference/metadata-api/table-view.mdx#metadata-bigquery-track-table-syntax) | 1 | Add a BigQuery table/view with configuration |
| [bigquery_untrack_table](/api-reference/metadata-api/table-view.mdx#metadata-bigquery-untrack-table) | [bigquery_untrack_table_args](/api-reference/metadata-api/table-view.mdx#metadata-bigquery-untrack-table-syntax) | 1 | Remove a BigQuery table/view |
| [bigquery_set_table_customization](/api-reference/metadata-api/table-view.mdx#metadata-bigquery-set-table-customization) | [bigquery_set_table_customization_args](/api-reference/metadata-api/table-view.mdx#metadata-bigquery-set-table-customization-syntax) | 1 | Set table customization of an already tracked BigQuery table |
| [bigquery_add_computed_field](/api-reference/metadata-api/computed-field.mdx#metadata-bigquery-add-computed-field) | [bigquery_add_computed_field_args](/api-reference/metadata-api/computed-field.mdx#metadata-bigquery-add-computed-field-syntax) | 1 | Add a computed field to a BigQuery table |
| [bigquery_drop_computed_field](/api-reference/metadata-api/computed-field.mdx#metadata-bigquery-drop-computed-field) | [bigquery_drop_computed_field_args](/api-reference/metadata-api/computed-field.mdx#metadata-bigquery-drop-computed-field-syntax) | 1 | Drop a BigQuery computed field |
| [mssql_add_source](/api-reference/metadata-api/source.mdx#mssql-add-source) | [mssql_add_source_args](/api-reference/metadata-api/source.mdx#mssql-add-source-syntax) | 1 | Add an MS SQL Server database |
| [mssql_drop_source](/api-reference/metadata-api/source.mdx#mssql-drop-source) | [mssql_drop_source_args](/api-reference/metadata-api/source.mdx#mssql-drop-source-syntax) | 1 | Remove an MS SQL Server database |
| [mssql_track_table](/api-reference/metadata-api/table-view.mdx#mssql-track-table) | [mssql_track_table_args](/api-reference/metadata-api/table-view.mdx#mssql-track-table-syntax) | 1 | Add an MS SQL Server table/view with configuration |
| [mssql_untrack_table](/api-reference/metadata-api/table-view.mdx#mssql-untrack-table) | [mssql_untrack_table_args](/api-reference/metadata-api/table-view.mdx#mssql-untrack-table-syntax) | 1 | Remove an MS SQL Server table/view |
| [mssql_update_source](/api-reference/metadata-api/source.mdx#mssql-update-source) | [mssql_update_source_args](/api-reference/metadata-api/source.mdx#mssql-update-source-syntax) | 1 | Update an MS SQL Server database |
| [mssql_create_object_relationship](/api-reference/metadata-api/relationship.mdx#mssql-create-object-relationship) | [mssql_create_object_relationship_args](/api-reference/metadata-api/relationship.mdx#mssql-create-object-relationship-syntax) | 1 | Define a new object relationship between MS SQL Server tables/views |
| [mssql_create_array_relationship](/api-reference/metadata-api/relationship.mdx#mssql-create-array-relationship) | [mssql_create_array_relationship_args](/api-reference/metadata-api/relationship.mdx#mssql-create-array-relationship-syntax) | 1 | Define a new array relationship between MS SQL Server tables/views |
| [mssql_drop_relationship](/api-reference/metadata-api/relationship.mdx#mssql-drop-relationship) | [mssql_drop_relationship_args](/api-reference/metadata-api/relationship.mdx#mssql-drop-relationship-syntax) | 1 | Drop an existing MS SQL Server relationship |
| [mssql_rename_relationship](/api-reference/metadata-api/relationship.mdx#mssql-rename-relationship) | [mssql_rename_relationship_args](/api-reference/metadata-api/relationship.mdx#mssql-rename-relationship-syntax) | 1 | Modify name of an existing MS SQL Server relationship |
| [mssql_set_relationship_comment](/api-reference/metadata-api/relationship.mdx#mssql-set-relationship-comment) | [mssql_set_relationship_comment_args](/api-reference/metadata-api/relationship.mdx#mssql-set-relationship-comment-syntax) | 1 | Set comment on an existing MS SQL Server relationship |
| [mssql_set_table_customization](/api-reference/metadata-api/table-view.mdx#mssql-set-table-customization) | [mssql_set_table_customization_args](/api-reference/metadata-api/table-view.mdx#mssql-set-table-customization-syntax) | 1 | Set table customization of an already tracked MS SQL Server table |
| [mssql_create_insert_permission](/api-reference/metadata-api/permission.mdx#mssql-create-insert-permission) | [mssql_create_insert_permission_args](/api-reference/metadata-api/permission.mdx#mssql-create-insert-permission-syntax) | 1 | Specify insert permission for an MS SQL Server table/view |
| [mssql_drop_insert_permission](/api-reference/metadata-api/permission.mdx#mssql-drop-insert-permission) | [mssql_drop_insert_permission_args](/api-reference/metadata-api/permission.mdx#mssql-drop-insert-permission-syntax) | 1 | Remove existing insert permission for an MS SQL Server table/view |
| [mssql_create_select_permission](/api-reference/metadata-api/permission.mdx#mssql-create-select-permission) | [mssql_create_select_permission_args](/api-reference/metadata-api/permission.mdx#mssql-create-select-permission-syntax) | 1 | Specify select permission for an MS SQL Server table/view |
| [mssql_drop_select_permission](/api-reference/metadata-api/permission.mdx#mssql-drop-select-permission) | [mssql_drop_select_permission_args](/api-reference/metadata-api/permission.mdx#mssql-drop-select-permission-syntax) | 1 | Remove existing select permission for an MS SQL Server table/view |
| [mssql_create_update_permission](/api-reference/metadata-api/permission.mdx#mssql-create-update-permission) | [mssql_create_update_permission_args](/api-reference/metadata-api/permission.mdx#mssql-create-update-permission-syntax) | 1 | Specify update permission for an MS SQL Server table/view |
| [mssql_drop_update_permission](/api-reference/metadata-api/permission.mdx#mssql-drop-update-permission) | [mssql_drop_update_permission_args](/api-reference/metadata-api/permission.mdx#mssql-drop-update-permission-syntax) | 1 | Remove existing update permission for an MS SQL Server table/view |
| [mssql_create_delete_permission](/api-reference/metadata-api/permission.mdx#mssql-create-delete-permission) | [mssql_create_delete_permission_args](/api-reference/metadata-api/permission.mdx#mssql-create-delete-permission-syntax) | 1 | Specify delete permission for an MS SQL Server table/view |
| [mssql_drop_delete_permission](/api-reference/metadata-api/permission.mdx#mssql-drop-delete-permission) | [mssql_drop_delete_permission_args](/api-reference/metadata-api/permission.mdx#mssql-drop-delete-permission-syntax) | 1 | Remove existing delete permission for an MS SQL Server table/view |
| [mssql_set_permission_comment](/api-reference/metadata-api/permission.mdx#mssql-set-permission-comment) | [mssql_set_permission_comment_args](/api-reference/metadata-api/permission.mdx#mssql-set-permission-comment-syntax) | 1 | Set comment on an existing permission for an MS SQL Server table/view |
| [create_cron_trigger](/api-reference/metadata-api/scheduled-triggers.mdx#metadata-create-cron-trigger) | [create_cron_trigger_args](/api-reference/metadata-api/scheduled-triggers.mdx#metadata-create-cron-trigger-syntax) | 1 | Create a cron trigger |
| [delete_cron_trigger](/api-reference/metadata-api/scheduled-triggers.mdx#metadata-delete-cron-trigger) | [delete_cron_trigger_args](/api-reference/metadata-api/scheduled-triggers.mdx#metadata-delete-cron-trigger-syntax) | 1 | Delete an existing cron trigger |
| [get_cron_triggers](/api-reference/metadata-api/scheduled-triggers.mdx#metadata-get-cron-triggers) | [Empty Object](/api-reference/syntax-defs.mdx#empty-object) | 1 | Returns all the cron triggers |
| [create_scheduled_event](/api-reference/metadata-api/scheduled-triggers.mdx#metadata-create-scheduled-event) | [create_scheduled_event_args](/api-reference/metadata-api/scheduled-triggers.mdx#metadata-create-scheduled-event-syntax) | 1 | Create a new scheduled event |
| [delete_scheduled_event](/api-reference/metadata-api/scheduled-triggers.mdx#metadata-delete-scheduled-event) | [delete_scheduled_event_args](/api-reference/metadata-api/scheduled-triggers.mdx#metadata-delete-scheduled-event-syntax) | 1 | Delete a scheduled event |
| [add_remote_schema](/api-reference/metadata-api/remote-schemas.mdx#metadata-add-remote-schema) | [add_remote_schema_args](/api-reference/metadata-api/remote-schemas.mdx#metadata-add-remote-schema-syntax) | 1 | Add a remote GraphQL server as a remote schema |
| [update_remote_schema](/api-reference/metadata-api/remote-schemas.mdx#metadata-update-remote-schema) | [update_remote_schema_args](/api-reference/metadata-api/remote-schemas.mdx#metadata-update-remote-schema-syntax) | 1 | Update the details for a remote schema |
| [remove_remote_schema](/api-reference/metadata-api/remote-schemas.mdx#metadata-remove-remote-schema) | [remove_remote_schema_args](/api-reference/metadata-api/remote-schemas.mdx#metadata-remove-remote-schema-syntax) | 1 | Remove an existing remote schema |
| [reload_remote_schema](/api-reference/metadata-api/remote-schemas.mdx#metadata-reload-remote-schema) | [reload_remote_schema_args](/api-reference/metadata-api/remote-schemas.mdx#metadata-reload-remote-schema-syntax) | 1 | Reload schema of an existing remote schema |
| [add_remote_schema_permissions](/api-reference/metadata-api/remote-schema-permissions.mdx#metadata-add-remote-schema-permissions) | [add_remote_schema_permissions](/api-reference/metadata-api/remote-schema-permissions.mdx#metadata-add-remote-schema-permissions-syntax) | 1 | Add permissions to a role of an existing remote schema |
| [drop_remote_schema_permissions](/api-reference/metadata-api/remote-schema-permissions.mdx#metadata-drop-remote-schema-permissions) | [drop_remote_schema_permissions](/api-reference/metadata-api/remote-schema-permissions.mdx#metadata-drop-remote-schema-permissions-syntax) | 1 | Drop existing permissions defined for a role for a remote schema |
| [pg_create_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-pg-create-remote-relationship) | [pg_create_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-pg-create-remote-relationship-syntax) | 1 | Create a remote relationship on a Postgres table |
| [pg_update_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-pg-update-remote-relationship) | [pg_update_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-pg-update-remote-relationship-syntax) | 1 | Update an existing remote relationship |
| [pg_delete_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-pg-delete-remote-relationship) | [pg_delete_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-pg-delete-remote-relationship-syntax) | 1 | Delete an existing remote relationship |
| [citus_create_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-citus-create-remote-relationship) | [citus_create_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-citus-create-remote-relationship-syntax) | 1 | Create a remote relationship on a citus table |
| [citus_update_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-citus-update-remote-relationship) | [citus_update_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-citus-update-remote-relationship-syntax) | 1 | Update an existing remote relationship |
| [citus_delete_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-citus-delete-remote-relationship) | [citus_delete_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-citus-delete-remote-relationship-syntax) | 1 | Delete an existing remote relationship |
| [mssql_create_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-mssql-create-remote-relationship) | [mssql_create_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-mssql-create-remote-relationship-syntax) | 1 | Create a remote relationship on an mssql table |
| [mssql_update_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-mssql-update-remote-relationship) | [mssql_update_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-mssql-update-remote-relationship-syntax) | 1 | Update an existing remote relationship |
| [mssql_delete_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-mssql-delete-remote-relationship) | [mssql_delete_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-mssql-delete-remote-relationship-syntax) | 1 | Delete an existing remote relationship |
| [bigquery_create_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-bigquery-create-remote-relationship) | [bigquery_create_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-bigquery-create-remote-relationship-syntax) | 1 | Create a remote relationship on a bigquery table |
| [bigquery_update_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-bigquery-update-remote-relationship) | [bigquery_update_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-bigquery-update-remote-relationship-syntax) | 1 | Update an existing remote relationship |
| [bigquery_delete_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-bigquery-delete-remote-relationship) | [bigquery_delete_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-bigquery-delete-remote-relationship-syntax) | 1 | Delete an existing remote relationship |
| [create_remote_schema_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-create-remote-schema-remote-relationship) | [create_remote_schema_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-create-remote-schema-remote-relationship-syntax) | 1 | Create a remote relationship on a remote schema's type |
| [update_remote_schema_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-update-remote-schema-remote-relationship) | [update_remote_schema_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-update-remote-schema-remote-relationship-syntax) | 1 | Update an existing remote relationship on a remote schema's type |
| [delete_remote_schema_remote_relationship](/api-reference/metadata-api/remote-relationships.mdx#metadata-delete-remote-schema-remote-relationship) | [delete_remote_schema_remote_relationship_args](/api-reference/metadata-api/remote-relationships.mdx#metadata-delete-remote-schema-remote-relationship-syntax) | 1 | Delete an existing remote relationship on a remote schema's type |
| [export_metadata](/api-reference/metadata-api/manage-metadata.mdx#metadata-export-metadata) | [Empty Object](/api-reference/syntax-defs.mdx#empty-object) | 1 | Export the current metadata |
| [export_metadata](/api-reference/metadata-api/manage-metadata.mdx#metadata-export-metadata) | [Empty Object](/api-reference/syntax-defs.mdx#empty-object) | 2 | Export existing metadata with resource version included. |
| [replace_metadata](/api-reference/metadata-api/manage-metadata.mdx#metadata-replace-metadata) | [replace_metadata_args](/api-reference/metadata-api/manage-metadata.mdx#metadata-replace-metadata-syntax) | 1 | Import and replace existing metadata |
| [replace_metadata](/api-reference/metadata-api/manage-metadata.mdx#metadata-replace-metadata) | [replace_metadata_args](/api-reference/metadata-api/manage-metadata.mdx#metadata-replace-metadata-syntax) | 2 | Replace existing metadata with check against current resource_version. |
| [reload_metadata](/api-reference/metadata-api/manage-metadata.mdx#metadata-reload-metadata) | [reload_metadata_args](/api-reference/metadata-api/manage-metadata.mdx#metadata-reload-metadata-syntax) | 1 | Reload changes to the underlying Postgres DB |
| [clear_metadata](/api-reference/metadata-api/manage-metadata.mdx#metadata-clear-metadata) | [Empty Object](/api-reference/syntax-defs.mdx#empty-object) | 1 | Clear/wipe-out the current metadata state form server |
| [get_inconsistent_metadata](/api-reference/metadata-api/manage-metadata.mdx#metadata-get-inconsistent-metadata) | [Empty Object](/api-reference/syntax-defs.mdx#empty-object) | 1 | List all inconsistent metadata objects |
| [drop_inconsistent_metadata](/api-reference/metadata-api/manage-metadata.mdx#metadata-drop-inconsistent-metadata) | [Empty Object](/api-reference/syntax-defs.mdx#empty-object) | 1 | Drop all inconsistent metadata objects |
| [create_query_collection](/api-reference/metadata-api/query-collections.mdx#metadata-create-query-collection) | [create_query_collection_args](/api-reference/metadata-api/query-collections.mdx#metadata-create-query-collection-syntax) | 1 | Create a query collection |
| [drop_query_collection](/api-reference/metadata-api/query-collections.mdx#metadata-drop-query-collection) | [drop_query_collection_args](/api-reference/metadata-api/query-collections.mdx#metadata-drop-query-collection-syntax) | 1 | Drop a query collection |
| [add_query_to_collection](/api-reference/metadata-api/query-collections.mdx#metadata-add-query-to-collection) | [add_query_to_collection_args](/api-reference/metadata-api/query-collections.mdx#metadata-add-query-to-collection-syntax) | 1 | Add a query to a given collection |
| [drop_query_from_collection](/api-reference/metadata-api/query-collections.mdx#metadata-drop-query-from-collection) | [drop_query_from_collection_args](/api-reference/metadata-api/query-collections.mdx#metadata-drop-query-from-collection-syntax) | 1 | Drop a query from a given collection |
| [add_collection_to_allowlist](/api-reference/metadata-api/query-collections.mdx#metadata-add-collection-to-allowlist) | [add_collection_to_allowlist_args](/api-reference/metadata-api/query-collections.mdx#metadata-add-collection-to-allowlist-syntax) | 1 | Add a collection to the allow-list |
| [drop_collection_from_allowlist](/api-reference/metadata-api/query-collections.mdx#metadata-drop-collection-from-allowlist) | [drop_collection_from_allowlist_args](/api-reference/metadata-api/query-collections.mdx#metadata-drop-collection-from-allowlist-syntax) | 1 | Drop a collection from the allow-list |
| [set_custom_types](/api-reference/metadata-api/custom-types.mdx#metadata-set-custom-types) | [set_custom_types_args](/api-reference/metadata-api/custom-types.mdx#metadata-set-custom-types-syntax) | 1 | Set custom GraphQL types |
| [create_action](/api-reference/metadata-api/actions.mdx#metadata-create-action) | [create_action_args](/api-reference/metadata-api/actions.mdx#metadata-create-action-syntax) | 1 | Create an action |
| [drop_action](/api-reference/metadata-api/actions.mdx#metadata-drop-action) | [drop_action_args](/api-reference/metadata-api/actions.mdx#metadata-drop-action-syntax) | 1 | Drop an action |
| [update_action](/api-reference/metadata-api/actions.mdx#metadata-update-action) | [update_action_args](/api-reference/metadata-api/actions.mdx#metadata-update-action-syntax) | 1 | Update an action |
| [create_action_permission](/api-reference/metadata-api/actions.mdx#metadata-create-action-permission) | [create_action_permission_args](/api-reference/metadata-api/actions.mdx#metadata-create-action-permission-syntax) | 1 | Create an action permission |
| [drop_action_permission](/api-reference/metadata-api/actions.mdx#metadata-drop-action-permission) | [drop_action_permission_args](/api-reference/metadata-api/actions.mdx#metadata-drop-action-permission-syntax) | 1 | Drop an action permission |
| [create_rest_endpoint](/api-reference/metadata-api/restified-endpoints.mdx#metadata-create-rest-endpoint) | [create_rest_endpoint_args](/api-reference/metadata-api/restified-endpoints.mdx#metadata-create-rest-endpoint-syntax) | 1 | Create a RESTified GraphQL Endpoint |
| [drop_rest_endpoint](/api-reference/metadata-api/restified-endpoints.mdx#metadata-drop-rest-endpoint) | [drop_rest_endpoint_args](/api-reference/metadata-api/restified-endpoints.mdx#metadata-drop-rest-endpoint-syntax) | 1 | Drop a RESTified GraphQL Endpoint |
| [add_inherited_role](/api-reference/metadata-api/inherited-roles.mdx#metadata-add-inherited-role) | [add_inherited_role_args](/api-reference/metadata-api/inherited-roles.mdx#metadata-add-inherited-role-syntax) | 1 | Add an inherited role |
| [drop_inherited_role](/api-reference/metadata-api/inherited-roles.mdx#metadata-drop-inherited-role) | [drop_inherited_role_args](/api-reference/metadata-api/inherited-roles.mdx#metadata-drop-inherited-role-syntax) | 1 | Drop an inherited role |
| [set_graphql_introspection_options](/api-reference/metadata-api/introspection.mdx#metadata-set-graphql-introspection-options) | [set_graphql_schema_introspection_options_args](/api-reference/metadata-api/introspection.mdx#metadata-set-graphql-schema-introspection-options-syntax) | 1 | Set graphql introspection options |
| [add_host_to_tls_allowlist](/api-reference/metadata-api/network.mdx#metadata-add-host-to-tls-allowlist) | [add_host_to_tls_allowlist_args](/api-reference/metadata-api/network.mdx#add-host-to-tls-allowlist-syntax) | 1 | Add an endpoint to the TLS Allowlist |
| [drop_host_from_tls_allowlist](/api-reference/metadata-api/network.mdx#metadata-drop-host-from-tls-allowlist) | [drop_host_from_tls_allowlist_args](/api-reference/metadata-api/network.mdx#drop-host-from-tls-allowlist-syntax) | 1 | Drop an endpoint from the TLS Allowlist |
<!--
TODO: MSSQL_UNSUPPORTED
| `mssql_set_table_is_enum` | `mssql_set_table_is_enum_args <mssql_set_table_is_enum_syntax>` | 1 | Set a tracked MS SQL Server table as an enum table |
| `mssql_track_function` | `mssql_track_function_args <mssql_track_function_syntax>` | 1 | Add an MS SQL Server SQL function with configuration |
| `mssql_untrack_function` | `FunctionName <FunctionName>` | 1 | Remove an MS SQL Server SQL function |
| `mssql_create_function_permission` | `mssql_create_function_permission_args <mssql_create_function_permission_syntax>` | 1 | Create an MS SQL Server function permission |
| `mssql_drop_function_permission` | `mssql_drop_function_permission_args <mssql_drop_function_permission_syntax>` | 1 | Drop an existing MS SQL Server function permission |
| `mssql_add_computed_field` | `mssql_add_computed_field_args <mssql_add_computed_field_syntax>` | 1 | Add a computed field to an MS SQL Server table/view |
| `mssql_drop_computed_field` | `mssql_drop_computed_field_args <mssql_drop_computed_field_syntax>` | 1 | Drop an MS SQL Server computed field |
| `mssql_create_event_trigger` | `mssql_create_event_trigger_args <mssql_create_event_trigger_syntax>` | 1 | Create or replace an event trigger on an MS SQL Server table |
| `mssql_delete_event_trigger` | `mssql_delete_event_trigger_args <mssql_delete_event_trigger_syntax>` | 1 | Delete an existing event trigger on an MS SQL Server table |
| `mssql_redeliver_event` | `mssql_redeliver_event_args <mssql_redeliver_event_syntax>` | 1 | Redeliver an existing event on an MS SQL Server table |
| `mssql_invoke_event_trigger` | `mssql_invoke_event_trigger_args <mssql_invoke_event_trigger_syntax>` | 1 | Invoke a trigger with custom payload on an MS SQL Server table |
-->
**See:**
- [Tables/Views](/api-reference/metadata-api/table-view.mdx)
- [Custom SQL Functions](/api-reference/metadata-api/custom-functions.mdx)
- [Relationships](/api-reference/metadata-api/relationship.mdx)
- [Computed Fields](/api-reference/metadata-api/computed-field.mdx)
- [Permissions](/api-reference/metadata-api/permission.mdx)
- [Inherited Roles](/api-reference/metadata-api/inherited-roles.mdx)
- [Remote Schema Permissions](/api-reference/metadata-api/remote-schema-permissions.mdx)
- [Event Triggers](/api-reference/metadata-api/event-triggers.mdx)
- [Remote Schemas](/api-reference/metadata-api/remote-schemas.mdx)
- [Query Collections](/api-reference/metadata-api/query-collections.mdx)
- [Custom Types](/api-reference/metadata-api/custom-types.mdx)
- [Actions](/api-reference/metadata-api/actions.mdx)
- [Manage Metadata](/api-reference/metadata-api/manage-metadata.mdx)
## Response structure
| Status code | Description | Response structure |
|-------------|-----------------------|-----------------------------------------|
| 200 | Success | Request specific |
| 400 | Bad request | `{ "path" : String, "error" : String}` |
| 401 | Unauthorized | `{"error" : String}` |
| 500 | Internal server error | `{"error" : String}` |
## Disabling metadata API
Since this API can be used to make changes to the GraphQL schema, it can
be disabled, especially in production deployments.
The `enabled-apis` flag or the `HASURA_GRAPHQL_ENABLED_APIS` env var can
be used to enable/disable this API. By default, the schema/metadata API
is enabled. To disable it, you need to explicitly state that this API is
not enabled i.e. remove it from the list of enabled APIs.
```bash
# enable only graphql api, disable metadata and pgdump
--enabled-apis="graphql"
HASURA_GRAPHQL_ENABLED_APIS="graphql"
```
See [GraphQL Engine server config reference](/deployment/graphql-engine-flags/reference.mdx) for info on setting the above flag/env var.
## Metadata Resource Versioning
Metadata is versioned with an optional `resource_version` field in
operations and responses.
This is intended to allow for feedback when replacing metadata with
modifications to an out-of-date copy.
The `resource_version` supplied must match the version returned
otherwise a 409 error response is returned.
The version is incremented on any operation that modified metadata as well as `reload_metadata`.

View File

@ -21,7 +21,7 @@ from other existing roles.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -50,8 +50,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------|----------|----------------|------------------------------------------------------------------------|
| role_name | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Name of the inherited role |
| role_set | true | [[RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename)] | List of non-inherited roles from which permissions should be inherited |
| role_name | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Name of the inherited role |
| role_set | true | [[RoleName](/api-reference/syntax-defs.mdx#rolename)] | List of non-inherited roles from which permissions should be inherited |
## drop_inherited_role {#metadata-drop-inherited-role}
@ -74,4 +74,4 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------|----------|------------|----------------------------|
| role_name | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Name of the inherited role |
| role_name | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Name of the inherited role |

View File

@ -46,4 +46,4 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------------------|----------|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
| disabled_for_roles | true | Array of [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Roles for which GraphQL schema introspection should be disabled *(supported only in cloud/enterprise versions)* |
| disabled_for_roles | true | Array of [RoleName](/api-reference/syntax-defs.mdx#rolename) | Roles for which GraphQL schema introspection should be disabled *(supported only in cloud/enterprise versions)* |

View File

@ -20,7 +20,7 @@ APIs for managing Hasura metadata which is stored in the `hdb catalog` schema.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -44,7 +44,7 @@ Response:
The response JSON will be the metadata object. The structure of the
metadata object is just a JSON version of the
[metadata files](/graphql/core/migrations/reference/metadata-format.mdx) generated by the CLI.
[metadata files](/migrations-metadata-seeds/metadata-format.mdx) generated by the CLI.
V2 Example:
@ -257,9 +257,9 @@ If the metadata is not consistent:
| Key | Required | Schema | Description |
|-------------------------|----------|-------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| reload_remote_schemas | false | `Boolean` \| \[[RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname)\] | If set to `true`, all remote schemas' (including inconsistent ones) cached GraphQL schemas are refreshed (default: `true`) |
| reload_sources | false | `Boolean` \| \[[SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename)\] | If set to `true`, all sources' (including inconsistent ones) cached GraphQL schemas are refreshed (default: `true`) |
| recreate_event_triggers | false | `Boolean` \| \[[SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename)\] | If set to `true`, all sources' (including inconsistent ones) cached event triggers and their corresponding SQL triggers present in the source database will be recreated. When an array of [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) is provided, the event triggers will only be recreated for those sources. (default: <em>false</em> i.e. no sources' event triggers will be recreated) |
| reload_remote_schemas | false | `Boolean` \| \[[RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname)\] | If set to `true`, all remote schemas' (including inconsistent ones) cached GraphQL schemas are refreshed (default: `true`) |
| reload_sources | false | `Boolean` \| \[[SourceName](/api-reference/syntax-defs.mdx#sourcename)\] | If set to `true`, all sources' (including inconsistent ones) cached GraphQL schemas are refreshed (default: `true`) |
| recreate_event_triggers | false | `Boolean` \| \[[SourceName](/api-reference/syntax-defs.mdx#sourcename)\] | If set to `true`, all sources' (including inconsistent ones) cached event triggers and their corresponding SQL triggers present in the source database will be recreated. When an array of [SourceName](/api-reference/syntax-defs.mdx#sourcename) is provided, the event triggers will only be recreated for those sources. (default: <em>false</em> i.e. no sources' event triggers will be recreated) |
## clear_metadata {#metadata-clear-metadata}

View File

@ -30,7 +30,7 @@ webhook or can be sent with the JWT token.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -121,11 +121,11 @@ In the above definition, the row is allowed to be inserted if the
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [InsertPermission](/graphql/core/api-reference/syntax-defs.mdx#insertpermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [InsertPermission](/api-reference/syntax-defs.mdx#insertpermission) | The permission definition |
| comment | false | text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_drop_insert_permission {#metadata-pg-drop-insert-permission}
@ -153,9 +153,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------|----------|----------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_create_select_permission {#metadata-pg-create-select-permission}
@ -245,11 +245,11 @@ The select permission of the `guest` role is configured in a way such that, it c
| Key | Required | Schema | Description |
|------------|----------|----------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [SelectPermission](/graphql/core/api-reference/syntax-defs.mdx#selectpermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [SelectPermission](/api-reference/syntax-defs.mdx#selectpermission) | The permission definition |
| comment | false | text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_drop_select_permission {#metadata-pg-drop-select-permission}
@ -277,9 +277,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------|----------|----------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_create_update_permission {#metadata-pg-create-update-permission}
@ -344,11 +344,11 @@ never be allowed to be updated.
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [UpdatePermission](/graphql/core/api-reference/syntax-defs.mdx#updatepermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [UpdatePermission](/api-reference/syntax-defs.mdx#updatepermission) | The permission definition |
| comment | false | text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_drop_update_permission {#metadata-pg-drop-update-permission}
@ -376,9 +376,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------|----------|-----------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_create_delete_permission {#metadata-pg-create-delete-permission}
@ -416,11 +416,11 @@ value."
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [DeletePermission](/graphql/core/api-reference/syntax-defs.mdx#deletepermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [DeletePermission](/api-reference/syntax-defs.mdx#deletepermission) | The permission definition |
| comment | false | text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_drop_delete_permission {#metadata-pg-drop-delete-permission}
@ -447,9 +447,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------|----------|----------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_set_permission_comment {#metadata-pg-set-permission-comment}
@ -479,11 +479,11 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|--------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | The role in the permission |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | The role in the permission |
| type | true | permission type (one of select/update/delete/insert) | The type of the permission |
| comment | false | Text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_create_insert_permission {#mssql-create-insert-permission}
@ -572,11 +572,11 @@ In the above definition, the row is allowed to be inserted if the
| Key | Required | Schema | Description |
|------------|----------|---------------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [InsertPermission](/graphql/core/api-reference/syntax-defs.mdx#insertpermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [InsertPermission](/api-reference/syntax-defs.mdx#insertpermission) | The permission definition |
| comment | false | text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_drop_insert_permission {#mssql-drop-insert-permission}
@ -603,9 +603,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------|----------|---------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_create_select_permission {#mssql-create-select-permission}
@ -697,11 +697,11 @@ The select permission of the `guest` role is configured in a way such that, it c
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [SelectPermission](/graphql/core/api-reference/syntax-defs.mdx#selectpermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [SelectPermission](/api-reference/syntax-defs.mdx#selectpermission) | The permission definition |
| comment | false | text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_drop_select_permission {#mssql-drop-select-permission}
@ -728,9 +728,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------|----------|----------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_create_update_permission {#mssql-create-update-permission}
@ -795,11 +795,11 @@ never be allowed to be updated.
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [UpdatePermission](/graphql/core/api-reference/syntax-defs.mdx#updatepermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [UpdatePermission](/api-reference/syntax-defs.mdx#updatepermission) | The permission definition |
| comment | false | text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_drop_update_permission {#mssql-drop-update-permission}
@ -827,9 +827,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------|----------|----------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_create_delete_permission {#mssql-create-delete-permission}
@ -867,11 +867,11 @@ value."
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [DeletePermission](/graphql/core/api-reference/syntax-defs.mdx#deletepermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [DeletePermission](/api-reference/syntax-defs.mdx#deletepermission) | The permission definition |
| comment | false | text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_drop_delete_permission {#mssql-drop-delete-permission}
@ -899,9 +899,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------|----------|----------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_set_permission_comment {#mssql-set-permission-comment}
@ -931,8 +931,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | The role in the permission |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | The role in the permission |
| type | true | permission type (one of select/update/delete/insert) | The type of the permission |
| comment | false | Text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |

View File

@ -22,7 +22,7 @@ the following query types.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -64,8 +64,8 @@ As the query collection is used in allowlists and REST endpoints, they are valid
| Key | Required | Schema | Description |
|------------|----------|---------------------------------------------------------------------------------------|------------------------------|
| name | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| definition | true | [CollectionQuery](/graphql/core/api-reference/syntax-defs.mdx#collectionquery) array | List of queries |
| name | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| definition | true | [CollectionQuery](/api-reference/syntax-defs.mdx#collectionquery) array | List of queries |
| comment | false | text | Optional comment |
## drop_query_collection {#metadata-drop-query-collection}
@ -90,7 +90,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|------------------|-------------------------------------------------------------------------------|
| collection | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| collection | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| cascade | true | boolean | When set to `true`, the collection (if present) is removed from the allowlist |
## add_query_to_collection {#metadata-add-query-to-collection}
@ -116,8 +116,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------------|----------|------------------------------------------------------------------------------|------------------------------|
| collection_name | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| query_name | true | [QueryName](/graphql/core/api-reference/syntax-defs.mdx#queryname) | Name of the query |
| collection_name | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| query_name | true | [QueryName](/api-reference/syntax-defs.mdx#queryname) | Name of the query |
| query | true | text | The GraphQL query text |
## drop_query_from_collection {#metadata-drop-query-from-collection}
@ -142,8 +142,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------------|----------|----------------------------------------------------------------------------------|------------------------------|
| collection_name | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| query_name | true | [QueryName](/graphql/core/api-reference/syntax-defs.mdx#queryname) | Name of the query |
| collection_name | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| query_name | true | [QueryName](/api-reference/syntax-defs.mdx#queryname) | Name of the query |
## add_collection_to_allowlist {#metadata-add-collection-to-allowlist}
@ -199,8 +199,8 @@ If a query occurs in multiple collections, a role will be allowed to access the
| Key | Required | Schema | Description |
|------------|----------|------------------|----------------------------------------------------------|
| collection | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of a query collection to be added to the allow-list |
| scope | false | [AllowlistScope](/graphql/core/api-reference/syntax-defs.mdx#allowlistscope) | Scope of the collection in the allowlist. (default: `{global: true}`) When the scope is global, the query collection's queries will be accessible to all roles. When the scope is non-global, the query collection's queries will be accessible to all of the roles listed in the scope. *(non-global scope supported only in cloud/enterprise versions)* |
| collection | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of a query collection to be added to the allow-list |
| scope | false | [AllowlistScope](/api-reference/syntax-defs.mdx#allowlistscope) | Scope of the collection in the allowlist. (default: `{global: true}`) When the scope is global, the query collection's queries will be accessible to all roles. When the scope is non-global, the query collection's queries will be accessible to all of the roles listed in the scope. *(non-global scope supported only in cloud/enterprise versions)* |
## update_scope_of_collection_in_allowlist {#metadata-update-scope-of-collection-in-allowlist}
@ -235,8 +235,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| collection | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of a query collection to be added to the allow-list |
| scope | true | [AllowlistScope](/graphql/core/api-reference/syntax-defs.mdx#allowlistscope) | Scope of the collection in the allowlist. When the scope is global, the query collection's queries will be accessible to all roles. When the scope is non-global, the query collection's queries will be accessible to all of the roles listed in the scope. *(non-global scope supported only in cloud/enterprise versions)* |
| collection | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of a query collection to be added to the allow-list |
| scope | true | [AllowlistScope](/api-reference/syntax-defs.mdx#allowlistscope) | Scope of the collection in the allowlist. When the scope is global, the query collection's queries will be accessible to all roles. When the scope is non-global, the query collection's queries will be accessible to all of the roles listed in the scope. *(non-global scope supported only in cloud/enterprise versions)* |
## drop_collection_from_allowlist {#metadata-drop-collection-from-allowlist}
@ -260,4 +260,4 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|------------------|--------------------------------------------------------------|
| collection | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of a query collection to be removed from the allow-list |
| collection | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of a query collection to be removed from the allow-list |

View File

@ -44,7 +44,7 @@ every `author`
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -189,11 +189,11 @@ defined on `article` table's `id` column to `article_detail` view's
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------------------|----------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ObjRelUsing](/graphql/core/api-reference/syntax-defs.mdx#objrelusing) | Use one of the available ways to define an object relationship |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ObjRelUsing](/api-reference/syntax-defs.mdx#objrelusing) | Use one of the available ways to define an object relationship |
| comment | false | text | comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_create_array_relationship {#metadata-pg-create-array-relationship}
@ -298,11 +298,11 @@ defined on the `author` table's `id` column to `article_detail` view's
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ArrRelUsing](/graphql/core/api-reference/syntax-defs.mdx#arrrelusing) | Use one of the available ways to define an array relationship |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ArrRelUsing](/api-reference/syntax-defs.mdx#arrrelusing) | Use one of the available ways to define an array relationship |
| comment | false | text | comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_drop_relationship {#metadata-pg-drop-relationship}
@ -333,10 +333,10 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------------|----------|-----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | Name of the relationship that needs to be dropped |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | Name of the relationship that needs to be dropped |
| cascade | false | Boolean | When set to `true`, all the dependent items on this relationship are also dropped |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
:::info Note
@ -372,10 +372,10 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------------|----------|-------------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| comment | false | Text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_rename_relationship {#metadata-pg-rename-relationship}
@ -403,10 +403,10 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|----------|----------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| new_name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | New relationship name |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| new_name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | New relationship name |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_create_object_relationship {#mssql-create-object-relationship}
@ -549,11 +549,11 @@ defined on `article` table's `id` column to `article_detail` view's
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------------------|----------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ObjRelUsing](/graphql/core/api-reference/syntax-defs.mdx#objrelusing) | Use one of the available ways to define an object relationship |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ObjRelUsing](/api-reference/syntax-defs.mdx#objrelusing) | Use one of the available ways to define an object relationship |
| comment | false | text | comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_create_array_relationship {#mssql-create-array-relationship}
@ -659,11 +659,11 @@ defined on the `author` table's `id` column to `article_detail` view's
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ArrRelUsing](/graphql/core/api-reference/syntax-defs.mdx#arrrelusing) | Use one of the available ways to define an array relationship |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ArrRelUsing](/api-reference/syntax-defs.mdx#arrrelusing) | Use one of the available ways to define an array relationship |
| comment | false | text | comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_drop_relationship {#mssql-drop-relationship}
@ -694,10 +694,10 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------------|----------|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | Name of the relationship that needs to be dropped |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | Name of the relationship that needs to be dropped |
| cascade | false | Boolean | When set to `true`, all the dependent items on this relationship are also dropped |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
:::info Note
@ -733,10 +733,10 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------------|----------|-------------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| comment | false | Text | Comment |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_rename_relationship {#mssql-rename-relationship}
@ -764,7 +764,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|----------|----------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| new_name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | New relationship name |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| new_name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | New relationship name |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |

View File

@ -21,7 +21,7 @@ other databases.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -117,10 +117,10 @@ database.
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
### Old format
@ -158,12 +158,12 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [QualifiedTable](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Object with table name and schema |
| hasura_fields | true | [[PGColumn](/graphql/core/api-reference/syntax-defs.mdx#pgcolumn) \| [ComputedFieldName](/graphql/core/api-reference/syntax-defs.mdx#computedfieldname)] | Column/Computed field(s) in the table that is used for joining with remote schema field. All join keys in `remote_field` must appear here. |
| remote_schema | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema to join with |
| remote_field | true | [RemoteField](/graphql/core/api-reference/syntax-defs.mdx#remotefield) | The schema tree ending at the field in remote schema which needs to be joined with |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [QualifiedTable](/api-reference/syntax-defs.mdx#tablename) | Object with table name and schema |
| hasura_fields | true | [[PGColumn](/api-reference/syntax-defs.mdx#pgcolumn) \| [ComputedFieldName](/api-reference/syntax-defs.mdx#computedfieldname)] | Column/Computed field(s) in the table that is used for joining with remote schema field. All join keys in `remote_field` must appear here. |
| remote_schema | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema to join with |
| remote_field | true | [RemoteField](/api-reference/syntax-defs.mdx#remotefield) | The schema tree ending at the field in remote schema which needs to be joined with |
## pg_update_remote_relationship {#metadata-pg-update-remote-relationship}
@ -232,10 +232,10 @@ _existing_ remote relationship defined on a Postgres table.
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
### Old format
@ -277,12 +277,12 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------|----------|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [QualifiedTable](/graphql/core/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| hasura_fields | true | \[[PGColumn](/graphql/core/api-reference/syntax-defs.mdx#pgcolumn)\] | Column(s) in the table that is used for joining with remote schema field. All join keys in `remote_field` must appear here. |
| remote_schema | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema to join with |
| remote_field | true | [RemoteField](/graphql/core/api-reference/syntax-defs.mdx#remotefield) | The schema tree ending at the field in remote schema which needs to be joined with. |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [QualifiedTable](/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| hasura_fields | true | \[[PGColumn](/api-reference/syntax-defs.mdx#pgcolumn)\] | Column(s) in the table that is used for joining with remote schema field. All join keys in `remote_field` must appear here. |
| remote_schema | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema to join with |
| remote_field | true | [RemoteField](/api-reference/syntax-defs.mdx#remotefield) | The schema tree ending at the field in remote schema which needs to be joined with. |
## pg_delete_remote_relationship {#metadata-pg-delete-remote-relationship}
@ -310,9 +310,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|-----------------------------------|-----------------------------------|
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Object with table name and schema |
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Object with table name and schema |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
## citus_create_remote_relationship {#metadata-citus-create-remote-relationship}
@ -405,10 +405,10 @@ database.
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
## citus_update_remote_relationship {#metadata-citus-update-remote-relationship}
@ -479,10 +479,10 @@ _existing_ remote relationship defined on a _Citus table_.
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
## citus_delete_remote_relationship {#metadata-citus-delete-remote-relationship}
@ -510,9 +510,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|-----------------------------------|-----------------------------------|
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
## mssql_create_remote_relationship {#metadata-mssql-create-remote-relationship}
`mssql_create_remote_relationship` is used to create a new remote relationship
@ -604,10 +604,10 @@ database.
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
## mssql_update_remote_relationship {#metadata-mssql-update-remote-relationship}
@ -677,10 +677,10 @@ _existing_ remote relationship defined on an _MS SQL table_.
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
## mssql_delete_remote_relationship {#metadata-mssql-delete-remote-relationship}
@ -708,9 +708,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|-----------------------------------|-----------------------------------|
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table on which the relationship is being defined |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
## bigquery_create_remote_relationship {#metadata-bigquery-create-remote-relationship}
@ -734,7 +734,10 @@ database.
"source": "app_db",
// name of the table in the above database on which the relationship
// is being defined
"table": "users",
"table": {
"dataset": "<source_dataset_name>",
"name": "users"
},
"definition": {
// this remote relationship is being defined to a resolver on a
// remote schema
@ -746,7 +749,7 @@ database.
"lhs_fields": ["id"],
// the join condition - this would generate this upstream request:
// query {
// messages(id: id_from_users_table) { .. }
// messages(user_id: id_from_users_table) { .. }
// }
"remote_field": {
"messages": {
@ -768,45 +771,52 @@ database.
X-Hasura-Role: admin
{
"type":"bigquery_create_remote_relationship",
"args":{
// name of the remote relationship
"name": "orders",
// name of the database
"source": "app_db",
// name of the table in the above database on which the relationship
// is being defined
"table": "users",
"definition": {
"to_source": {
// the type of the relationship, an 'object' (many-to-one) or an
// 'array' (one-to-many)
"relationship_type": "array",
// the database where the target table exists
"source": "store_db",
// name of the table which is the target of the remote
// relationship
"table": "orders"
// the join condition is specified by a mapping of columns from
// the source's table to the target's table, i.e,
// app_db.users.id = store_db.orders.user_id
"field_mapping": {
"id": "user_id"
}
"type": "bigquery_create_remote_relationship",
"args": {
// name of the remote relationship
"name": "orders",
// name of the database
"source": "app_db",
// name of the table in the above database on which the relationship
// is being defined
"table": {
"dataset": "<source_dataset_name>",
"name": "users"
},
"definition": {
"to_source": {
// the type of the relationship, an 'object' (many-to-one) or an
// 'array' (one-to-many)
"relationship_type": "array",
// the database where the target table exists
"source": "store_db",
// name of the table which is the target of the remote
// relationship
"table": {
"name": "orders",
"dataset": "<target_dataset_name>"
},
// the join condition is specified by a mapping of columns from
// the source's table to the target's table, i.e,
// app_db.users.id = store_db.orders.user_id
"field_mapping": {
"id": "user_id"
}
}
}
}
}
}
```
### Args syntax {#metadata-bigquery-create-remote-relationship-syntax}
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [BigQueryTableName](/graphql/core/api-reference/syntax-defs.mdx#bigquerytablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [BigQueryTableName](/api-reference/syntax-defs.mdx#bigquerytablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
## bigquery_update_remote_relationship {#metadata-bigquery-update-remote-relationship}
@ -877,10 +887,10 @@ _existing_ remote relationship defined on a _BigQuery table_.
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [BigQueryTableName](/graphql/core/api-reference/syntax-defs.mdx#bigquerytablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [BigQueryTableName](/api-reference/syntax-defs.mdx#bigquerytablename) | Name of the table on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
## bigquery_delete_remote_relationship {#metadata-bigquery-delete-remote-relationship}
@ -908,9 +918,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|-----------------------------------|-----------------------------------|
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [BigQueryTableName](/graphql/core/api-reference/syntax-defs.mdx#bigquerytablename) | Name of the table on which the relationship is being defined |
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| table | true | [BigQueryTableName](/api-reference/syntax-defs.mdx#bigquerytablename) | Name of the table on which the relationship is being defined |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
## create_remote_schema_remote_relationship {#metadata-create-remote-schema-remote-relationship}
@ -1012,10 +1022,10 @@ are supported.
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| remote_schema | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| type | true | [GraphQLName](/graphql/core/api-reference/syntax-defs.mdx#graphqlname) | Name of the type on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| remote_schema | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| type | true | [GraphQLName](/api-reference/syntax-defs.mdx#graphqlname) | Name of the type on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
## update_remote_schema_remote_relationship {#metadata-update-remote-schema-remote-relationship}
@ -1084,10 +1094,10 @@ relationship defined on a remote schema's type.
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| remote_schema | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| type | true | [GraphQLName](/graphql/core/api-reference/syntax-defs.mdx#graphqlname) | Name of the type on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| remote_schema | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| type | true | [GraphQLName](/api-reference/syntax-defs.mdx#graphqlname) | Name of the type on which the relationship is being defined |
| definition | true | [RemoteRelationshipDefinition](/api-reference/syntax-defs.mdx#remoterelationshipdefinition) | Definition of the remote relationship |
## delete_remote_schema_remote_relationship {#metadata-delete-remote-schema-remote-relationship}
@ -1113,8 +1123,6 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| remote_schema | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| type | true | [GraphQLName](/graphql/core/api-reference/syntax-defs.mdx#graphqlname) | Name of the type on which the relationship is being defined |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| remote_schema | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| type | true | [GraphQLName](/api-reference/syntax-defs.mdx#graphqlname) | Name of the type on which the relationship is being defined |

View File

@ -27,7 +27,7 @@ schema.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -190,7 +190,7 @@ fields during execution. This way the field is executed with limited
input values. Argument presets are of two types:
1. Static Value
2. [Session Variable](/graphql/core/auth/authorization/roles-variables.mdx#dynamic-session-variables)
2. [Session Variable](/auth/authorization/roles-variables.mdx#dynamic-session-variables)
A preset value can be added to an input value via the `@preset`
directive.
@ -219,7 +219,7 @@ before querying the remote schema.
:::info Note
By default, if the input value preset contains a
[session variable value](/graphql/core/auth/authorization/roles-variables.mdx#dynamic-session-variables), then its value
[session variable value](/auth/authorization/roles-variables.mdx#dynamic-session-variables), then its value
will be resolved when the query is executed. To treat the session
variable value as a literal value (avoiding resolving of the session
variable value) can be done by specifying `static` as `true` while
@ -335,9 +335,9 @@ engine before it queries the remote schema.
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------------------------------|-----------------------------------------|
| remote_schema | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| definition | true | [RemoteSchemaPermission](/graphql/core/api-reference/syntax-defs.mdx#remoteschemapermission) | The remote schema permission definition |
| remote_schema | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| definition | true | [RemoteSchemaPermission](/api-reference/syntax-defs.mdx#remoteschemapermission) | The remote schema permission definition |
| comment | false | text | Comment |
## drop_remote_schema_permissions {#metadata-drop-remote-schema-permissions}
@ -365,5 +365,5 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|----------------------------------------------------------------------------------|---------------------------|
| table | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| table | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |

View File

@ -20,7 +20,7 @@ engine.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -73,8 +73,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|----------------------------------|
| name | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| definition | true | [RemoteSchemaDef](/graphql/core/api-reference/syntax-defs.mdx#remoteschemadef) | Definition for the remote schema |
| name | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| definition | true | [RemoteSchemaDef](/api-reference/syntax-defs.mdx#remoteschemadef) | Definition for the remote schema |
| comment | false | Text | comment |
## update_remote_schema {#metadata-update-remote-schema}
@ -130,8 +130,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|----------------------------------|
| name | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| definition | true | [RemoteSchemaDef](/graphql/core/api-reference/syntax-defs.mdx#remoteschemadef) | Definition for the remote schema |
| name | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| definition | true | [RemoteSchemaDef](/api-reference/syntax-defs.mdx#remoteschemadef) | Definition for the remote schema |
| comment | false | Text | comment |
@ -159,7 +159,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------|----------|----------------------------------------------------------------------------------|---------------------------|
| name | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| name | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
## reload_remote_schema {#metadata-reload-remote-schema}
@ -186,4 +186,4 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------|----------|----------------------------------------------------------------------------------|---------------------------|
| name | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| name | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |

View File

@ -19,7 +19,7 @@ Add/Remove a RESTified GraphQL endpoint to Hasura GraphQL engine.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -56,9 +56,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-------------------|---------------------------------------------------------|
| name | true | Text | A unique identifier for the endpoint |
| url | true | [EndpointUrl](/graphql/core/api-reference/syntax-defs.mdx#endpointurl) | URL of the REST endpoint |
| methods | true | [EndpointMethods](/graphql/core/api-reference/syntax-defs.mdx#endpointmethods) | Non-Empty case sensitive list of supported HTTP Methods |
| definition | true | [EndpointDef](/graphql/core/api-reference/syntax-defs.mdx#endpointdef) | Definition for the REST endpoint |
| url | true | [EndpointUrl](/api-reference/syntax-defs.mdx#endpointurl) | URL of the REST endpoint |
| methods | true | [EndpointMethods](/api-reference/syntax-defs.mdx#endpointmethods) | Non-Empty case sensitive list of supported HTTP Methods |
| definition | true | [EndpointDef](/api-reference/syntax-defs.mdx#endpointdef) | Definition for the REST endpoint |
| comment | false | Text | comment |
:::tip Supported from

View File

@ -20,7 +20,7 @@ cron.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -53,17 +53,17 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------------------|----------|----------------------------------------------------------------------------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the cron trigger |
| webhook | true | [WebhookURL](/graphql/core/api-reference/syntax-defs.mdx#webhookurl) | URL of the webhook |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the cron trigger |
| webhook | true | [WebhookURL](/api-reference/syntax-defs.mdx#webhookurl) | URL of the webhook |
| schedule | true | Cron Expression | Cron expression at which the trigger should be invoked. |
| payload | false | JSON | Any JSON payload which will be sent when the webhook is invoked. |
| headers | false | [[HeaderFromValue](/graphql/core/api-reference/syntax-defs.mdx#headerfromvalue) \| [HeaderFromEnv](/graphql/core/api-reference/syntax-defs.mdx#headerfromenv)] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConfST](/graphql/core/api-reference/syntax-defs.mdx#retryconfst) | Retry configuration if scheduled invocation delivery fails |
| headers | false | [[HeaderFromValue](/api-reference/syntax-defs.mdx#headerfromvalue) \| [HeaderFromEnv](/api-reference/syntax-defs.mdx#headerfromenv)] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConfST](/api-reference/syntax-defs.mdx#retryconfst) | Retry configuration if scheduled invocation delivery fails |
| include_in_metadata | true | Boolean | Flag to indicate whether a trigger should be included in the metadata. When a cron trigger is included in the metadata, the user will be able to export it when the metadata of the graphql-engine is exported. |
| comment | false | Text | Custom comment. |
| replace | false | Bool | When replace is set to `true`, the cron trigger will be updated(if exists) and when it's `false` or the field is omitted, then a new cron trigger will be created. |
| request_transform | false | [RequestTransformation](/graphql/core/api-reference/syntax-defs.mdx#requesttransformation) | Attaches a Request Transformation to the Event Trigger. |
| response_transform | false | [ResponseTransformation](/graphql/core/api-reference/syntax-defs.mdx#responsetransformation) | Attaches a Request Transformation to the Event Trigger. |
| request_transform | false | [RequestTransformation](/api-reference/syntax-defs.mdx#requesttransformation) | Attaches a Request Transformation to the Event Trigger. |
| response_transform | false | [ResponseTransformation](/api-reference/syntax-defs.mdx#responsetransformation) | Attaches a Request Transformation to the Event Trigger. |
:::tip Supported from
@ -94,7 +94,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------|----------|-----------------------------|--------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the cron trigger |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the cron trigger |
:::tip Supported from
@ -146,11 +146,11 @@ Content-Type: application/json
| Key | Required | Schema | Description |
|-------------|----------|------------------------------------------------------------------------------|------------------------------------------------------------------|
| webhook | true | [WebhookURL](/graphql/core/api-reference/syntax-defs.mdx#webhookurl) | URL of the webhook |
| webhook | true | [WebhookURL](/api-reference/syntax-defs.mdx#webhookurl) | URL of the webhook |
| schedule_at | true | Timestamp (ISO8601 format) | The time at which the invocation should be invoked. |
| payload | false | JSON | Any JSON payload which will be sent when the webhook is invoked. |
| headers | false | [[HeaderFromValue](/graphql/core/api-reference/syntax-defs.mdx#headerfromvalue) \| [HeaderFromEnv](/graphql/core/api-reference/syntax-defs.mdx#headerfromenv)] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConfST](/graphql/core/api-reference/syntax-defs.mdx#retryconfst) | Retry configuration if scheduled event delivery fails |
| headers | false | [[HeaderFromValue](/api-reference/syntax-defs.mdx#headerfromvalue) \| [HeaderFromEnv](/api-reference/syntax-defs.mdx#headerfromenv)] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConfST](/api-reference/syntax-defs.mdx#retryconfst) | Retry configuration if scheduled event delivery fails |
| comment | false | Text | Custom comment. |
:::tip Supported from

View File

@ -20,7 +20,7 @@ Add/remove databases in Hasura GraphQL engine.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
replaces the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -76,15 +76,15 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------------------|----------|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the Postgres database |
| configuration | true | [PGConfiguration](/graphql/core/api-reference/syntax-defs.mdx#pgconfiguration) | Database connection configuration |
| name | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the Postgres database |
| configuration | true | [PGConfiguration](/api-reference/syntax-defs.mdx#pgconfiguration) | Database connection configuration |
| replace_configuration | false | Boolean | If set to `true` the configuration and customization will be replaced if the source with given name already exists (default: `false`) |
| customization | false | [SourceCustomization](/graphql/core/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |
| customization | false | [SourceCustomization](/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |
:::tip Deprecated field
The `replace_configuration` field is deprecated in favour of the
[pg_update_source API](/graphql/core/api-reference/metadata-api/source.mdx#metadata-pg-update-source).
[pg_update_source API](/api-reference/metadata-api/source.mdx#metadata-pg-update-source).
:::
@ -112,7 +112,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|---------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the Postgres database |
| name | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the Postgres database |
| cascade | false | Boolean | When set to `true`, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions etc.) from other sources (default: `false`) |
## rename_source {#metadata-rename-source}
@ -141,8 +141,8 @@ Note that all settings are kept, only the name is changed.
| Key | Required | Schema | Description |
|----------|----------|---------------------------|----------------------|
| name | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the database |
| new_name | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the database |
| name | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the database |
| new_name | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the database |
## pg_update_source {#metadata-pg-update-source}
@ -195,9 +195,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------------------|----------|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| name | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the Postgres database |
| configuration | false | [PGConfiguration](/graphql/core/api-reference/syntax-defs.mdx#pgconfiguration) | Database connection configuration |
| customization | false | [SourceCustomization](/graphql/core/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |
| name | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the Postgres database |
| configuration | false | [PGConfiguration](/api-reference/syntax-defs.mdx#pgconfiguration) | Database connection configuration |
| customization | false | [SourceCustomization](/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |
## mssql_add_source {#mssql-add-source}
@ -244,15 +244,15 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------------------|----------|----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the MS SQL Server database |
| configuration | true | [MsSQLConfiguration](/graphql/core/api-reference/syntax-defs.mdx#mssqlconfiguration) | Database connection configuration |
| name | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the MS SQL Server database |
| configuration | true | [MsSQLConfiguration](/api-reference/syntax-defs.mdx#mssqlconfiguration) | Database connection configuration |
| replace_configuration | false | Boolean | If set to `true` the configuration and customization will be replaced if the source with given name already exists (default: `false`) |
| customization | false | [SourceCustomization](/graphql/core/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |
| customization | false | [SourceCustomization](/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |
:::tip Deprecated field
The `replace_configuration` field is deprecated in favour of the
[mssql_update_source API](/graphql/core/api-reference/metadata-api/source.mdx#mssql-update-source).
[mssql_update_source API](/api-reference/metadata-api/source.mdx#mssql-update-source).
:::
@ -279,7 +279,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|---------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the MS SQL Server database |
| name | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the MS SQL Server database |
| cascade | false | Boolean | When set to `true`, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions etc.) from other sources (default: `false`) |
## mssql_update_source {#mssql-update-source}
@ -327,9 +327,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------------------|----------|----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| name | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the MS SQL Server database |
| configuration | false | [MsSQLConfiguration](/graphql/core/api-reference/syntax-defs.mdx#mssqlconfiguration) | Database connection configuration |
| customization | false | [SourceCustomization](/graphql/core/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |
| name | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the MS SQL Server database |
| configuration | false | [MsSQLConfiguration](/api-reference/syntax-defs.mdx#mssqlconfiguration) | Database connection configuration |
| customization | false | [SourceCustomization](/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |
## bigquery_add_source {#metadata-bigquery-add-source}
@ -370,15 +370,15 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------------------|----------|--------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the BigQuery database |
| configuration | true | [BigQueryConfiguration](/graphql/core/api-reference/syntax-defs.mdx#bigqueryconfiguration) | Database connection configuration |
| name | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the BigQuery database |
| configuration | true | [BigQueryConfiguration](/api-reference/syntax-defs.mdx#bigqueryconfiguration) | Database connection configuration |
| replace_configuration | false | Boolean | If set to `true` the configuration and customization will be replaced if the source with given name already exists (default: `false`) |
| customization | false | [SourceCustomization](/graphql/core/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |
| customization | false | [SourceCustomization](/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |
:::tip Deprecated field
The `replace_configuration` field is deprecated in favour of the
[bigquery_update_source API](/graphql/core/api-reference/metadata-api/source.mdx#metadata-bigquery-update-source).
[bigquery_update_source API](/api-reference/metadata-api/source.mdx#metadata-bigquery-update-source).
:::
@ -405,7 +405,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|---------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the BigQuery database |
| name | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the BigQuery database |
| cascade | false | Boolean | When set to `true`, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions etc.) from other sources (default: `false`) |
## bigquery_update_source {#metadata-bigquery-update-source}
@ -447,6 +447,6 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------------------|----------|--------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| name | true | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the BigQuery database |
| configuration | false | [BigQueryConfiguration](/graphql/core/api-reference/syntax-defs.mdx#bigqueryconfiguration) | Database connection configuration |
| customization | false | [SourceCustomization](/graphql/core/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |
| name | true | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the BigQuery database |
| configuration | false | [BigQueryConfiguration](/api-reference/syntax-defs.mdx#bigqueryconfiguration) | Database connection configuration |
| customization | false | [SourceCustomization](/api-reference/syntax-defs.mdx#sourcecustomization) | Customize root fields and type names for the source |

View File

@ -3,12 +3,12 @@ sidebar_label: Tables/Views
sidebar_position: 2
description: Manage tables and views with the Hasura metadata API
keywords:
- hasura
- docs
- metadata API
- API reference
- table
- view
- hasura
- docs
- metadata API
- API reference
- table
- view
---
# Metadata API Reference: Tables/Views
@ -17,20 +17,19 @@ keywords:
Track/untrack a table/view in Hasura GraphQL engine.
Only tracked tables/views are available for
querying/mutating/subscribing data over the GraphQL API.
Only tracked tables/views are available for querying/mutating/subscribing data over the GraphQL API.
:::tip Supported from
The metadata API is supported for versions `v2.0.0` and above and
replaces the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
The metadata API is supported for versions `v2.0.0` and above and replaces the older
[schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
## pg_track_table {#metadata-pg-track-table}
`pg_track_table` is used to add a table/view to the GraphQL schema with
configuration. You can customise the root field names.
`pg_track_table` is used to add a table/view to the GraphQL schema with configuration. You can customise the root field
names.
Add a table/view `author`:
@ -68,10 +67,9 @@ X-Hasura-Role: admin
}
```
A table can be tracked with a `custom name`. This can be useful when a
table name is not GraphQL compliant, like `Users Address`. A
`custom name` like `users_address` will complement the `"Users Address"`
table, so that it can be added to the GraphQL schema.
A table can be tracked with a `custom name`. This can be useful when a table name is not GraphQL compliant, like
`Users Address`. A `custom name` like `users_address` will complement the `"Users Address"` table, so that it can be
added to the GraphQL schema.
```http
POST /v1/metadata HTTP/1.1
@ -90,35 +88,33 @@ X-Hasura-Role: admin
}
```
The GraphQL nodes and typenames that are generated will be according to
the `identifier`. For example, in this case, the nodes generated will
be:
The GraphQL nodes and typenames that are generated will be according to the `identifier`. For example, in this case, the
nodes generated will be:
- `users_address`
- `users_address_one`
- `users_address_aggregate`
- `insert_users_address`
- `insert_users_address_one`
- `update_users_address`
- `update_users_address_by_pk`
- `delete_users_address`
- `delete_users_address_by_pk`
- `users_address`
- `users_address_one`
- `users_address_aggregate`
- `insert_users_address`
- `insert_users_address_one`
- `update_users_address`
- `update_users_address_by_pk`
- `delete_users_address`
- `delete_users_address_by_pk`
:::info Note
Hasura GraphQL engine requires the constraint names (if any) of a table
to be [GraphQL compliant](https://spec.graphql.org/June2018/#sec-Names)
in order to be able to track it.
Hasura GraphQL engine requires the constraint names (if any) of a table to be
[GraphQL compliant](https://spec.graphql.org/June2018/#sec-Names) in order to be able to track it.
:::
### Args syntax {#metadata-pg-track-table-syntax}
| Key | Required | Schema | Description |
|---------------|----------|--------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [Table Config](/graphql/core/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| Key | Required | Schema | Description |
| ------------- | -------- | ----------------------------------------------------------- | ------------------------------------------------------------- |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [Table Config](/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_untrack_table {#metadata-pg-untrack-table}
@ -146,16 +142,16 @@ X-Hasura-Role: admin
### Args syntax {#metadata-pg-untrack-table-syntax}
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| cascade | false | Boolean | When set to `true`, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions, templates) |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| Key | Required | Schema | Description |
| ------- | -------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| cascade | false | Boolean | When set to `true`, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions, templates) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_set_table_is_enum {#metadata-pg-set-table-is-enum}
`pg_set_table_is_enum` sets whether an already-tracked table should be
used as an [enum table](/graphql/core/databases/postgres/schema/enums.mdx#pg-create-enum-table).
`pg_set_table_is_enum` sets whether an already-tracked table should be used as an
[enum table](/schema/postgres/enums.mdx#pg-create-enum-table).
Use table `user_role` as an enum table:
@ -179,18 +175,16 @@ X-Hasura-Role: admin
### Args syntax {#metadata-pg-set-table-is-enum-syntax}
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| is_enum | true | Boolean | Whether or not the table should be used as an `enum table <enum table>`. |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| Key | Required | Schema | Description |
| ------- | -------- | ------------------------------------------------------- | ------------------------------------------------------------------------ |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| is_enum | true | Boolean | Whether or not the table should be used as an `enum table <enum table>`. |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## pg_set_table_customization {#metadata-pg-set-table-customization}
`pg_set_table_customization` allows you to customize any given table
with a custom name, custom root fields and custom column names of an
already tracked table. This will **replace** the already present
customization.
`pg_set_table_customization` allows you to customize any given table with a custom name, custom root fields and custom
column names of an already tracked table. This will **replace** the already present customization.
Set the configuration for a table/view called `author`:
@ -230,16 +224,16 @@ X-Hasura-Role: admin
### Args syntax {#metadata-pg-set-table-customization-syntax}
| Key | Required | Schema | Description |
|---------------|----------|-------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [TableConfig](/graphql/core/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| Key | Required | Schema | Description |
| ------------- | -------- | ---------------------------------------------------------- | ------------------------------------------------------------- |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [TableConfig](/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_track_table {#mssql-track-table}
`mssql_track_table` is used to add a table/view to the GraphQL schema
with configuration. You can customise the root field names.
`mssql_track_table` is used to add a table/view to the GraphQL schema with configuration. You can customise the root
field names.
Add a table/view `author`:
@ -256,6 +250,7 @@ X-Hasura-Role: admin
}
}
```
<!--
.. TODO: MSSQL_UNSUPPORTED
@ -298,19 +293,18 @@ X-Hasura-Role: admin
:::info Note
Hasura GraphQL engine requires the constraint names (if any) of a table
to be [GraphQL compliant](https://spec.graphql.org/June2018/#sec-Names)
in order to be able to track it.
Hasura GraphQL engine requires the constraint names (if any) of a table to be
[GraphQL compliant](https://spec.graphql.org/June2018/#sec-Names) in order to be able to track it.
:::
### Args syntax {#mssql-track-table-syntax}
| Key | Required | Schema | Description |
|---------------|----------|--------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [Table Config](/graphql/core/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| Key | Required | Schema | Description |
| ------------- | -------- | ----------------------------------------------------------- | ------------------------------------------------------------- |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [Table Config](/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_untrack_table {#mssql-untrack-table}
@ -338,18 +332,16 @@ X-Hasura-Role: admin
### Args syntax {#mssql-untrack-table-syntax}
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| cascade | false | Boolean | When set to `true`, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions, templates) |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| Key | Required | Schema | Description |
| ------- | -------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| cascade | false | Boolean | When set to `true`, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions, templates) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## mssql_set_table_customization {#mssql-set-table-customization}
`mssql_set_table_customization` allows you to customize any given table
with a custom name, custom root fields and custom column names of an
already tracked table. This will **replace** the already present
customization.
`mssql_set_table_customization` allows you to customize any given table with a custom name, custom root fields and
custom column names of an already tracked table. This will **replace** the already present customization.
Set the configuration for a table/view called `author`:
@ -382,16 +374,16 @@ X-Hasura-Role: admin
### Args syntax {#mssql-set-table-customization-syntax}
| Key | Required | Schema | Description |
|---------------|----------|-------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [TableConfig](/graphql/core/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| Key | Required | Schema | Description |
| ------------- | -------- | ---------------------------------------------------------- | ------------------------------------------------------------- |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [TableConfig](/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## bigquery_track_table {#metadata-bigquery-track-table}
`bigquery_track_table` is used to add a table/view to the GraphQL schema
with configuration. You can customise the root field names.
`bigquery_track_table` is used to add a table/view to the GraphQL schema with configuration. You can customise the root
field names.
Add a table/view `author`:
@ -412,9 +404,9 @@ X-Hasura-Role: admin
}
```
In the case of BigQuery, dataset names are prefixed to table/view names
to form a unique root field name, such that the above example will
result in the root field name being `hasura_author`.
In the case of BigQuery, dataset names are prefixed to table/view names to form a unique root field name, such that the
above example will result in the root field name being `hasura_author`.
<!--
.. TODO: BIGQUERY_UNSUPPORTED
@ -489,19 +481,18 @@ result in the root field name being `hasura_author`.
:::info Note
Hasura GraphQL engine requires the constraint names (if any) of a table
to be [GraphQL compliant](https://spec.graphql.org/June2018/#sec-Names)
in order to be able to track it.
Hasura GraphQL engine requires the constraint names (if any) of a table to be
[GraphQL compliant](https://spec.graphql.org/June2018/#sec-Names) in order to be able to track it.
:::
### Args syntax {#metadata-bigquery-track-table-syntax}
| Key | Required | Schema | Description |
|---------------|----------|--------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | {"dataset":\_, "name":\_} | Name of the table |
| configuration | false | [Table Config](/graphql/core/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| Key | Required | Schema | Description |
| ------------- | -------- | ----------------------------------------------------------- | ------------------------------------------------------------- |
| table | true | {"dataset":\_, "name":\_} | Name of the table |
| configuration | false | [Table Config](/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## bigquery_untrack_table {#metadata-bigquery-untrack-table}
@ -529,18 +520,16 @@ X-Hasura-Role: admin
### Args syntax {#metadata-bigquery-untrack-table-syntax}
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|
| table | true | {"dataset":\_, "name":\_} | Name of the table |
| cascade | false | Boolean | When set to `true`, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions, templates) |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| Key | Required | Schema | Description |
| ------- | -------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| table | true | {"dataset":\_, "name":\_} | Name of the table |
| cascade | false | Boolean | When set to `true`, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions, templates) |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
## bigquery_set_table_customization {#metadata-bigquery-set-table-customization}
`bigquery_set_table_customization` allows you to customize any given
table with a custom name, custom root fields and custom column names of
an already tracked table. This will **replace** the already present
customization.
`bigquery_set_table_customization` allows you to customize any given table with a custom name, custom root fields and
custom column names of an already tracked table. This will **replace** the already present customization.
Set the configuration for a table/view called `hasura_author_details` to `author`:
@ -576,8 +565,8 @@ X-Hasura-Role: admin
### Args syntax {#metadata-bigquery-set-table-customization-syntax}
| Key | Required | Schema | Description |
|---------------|----------|-------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | {"dataset":\_, "name":\_} | Name of the table |
| configuration | false | [TableConfig](/graphql/core/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/graphql/core/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |
| Key | Required | Schema | Description |
| ------------- | -------- | ---------------------------------------------------------- | ------------------------------------------------------------- |
| table | true | {"dataset":\_, "name":\_} | Name of the table |
| configuration | false | [TableConfig](/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| source | false | [SourceName](/api-reference/syntax-defs.mdx#sourcename) | Name of the source database of the table (default: `default`) |

View File

@ -98,4 +98,4 @@ not enabled. i.e. remove it from the list of enabled APIs.
HASURA_GRAPHQL_ENABLED_APIS="graphql,metadata"
```
See [GraphQL Engine server config reference](/graphql/core/deployment/graphql-engine-flags/reference.mdx) for info on setting the above flag/env var.
See [GraphQL Engine server config reference](/deployment/graphql-engine-flags/reference.mdx) for info on setting the above flag/env var.

View File

@ -25,8 +25,8 @@ All requests are `POST` requests to the `/v1beta1/relay` endpoint.
The following types of requests can be made using the Relay GraphQL API:
- [Query / Subscription](/graphql/core/api-reference/relay-graphql-api/query.mdx)
- [Mutation](/graphql/core/api-reference/relay-graphql-api/mutation.mdx)
- [Query / Subscription](/api-reference/relay-graphql-api/query.mdx)
- [Mutation](/api-reference/relay-graphql-api/mutation.mdx)
## Batching requests

View File

@ -14,7 +14,7 @@ import GraphiQLIDE from '@site/src/components/GraphiQLIDE';
# Relay API Reference - Mutation
The Mutation API is similar to [GraphQL mutation](/graphql/core/api-reference/graphql-api/mutation.mdx)
The Mutation API is similar to [GraphQL mutation](/api-reference/graphql-api/mutation.mdx)
except that the `id` field in the table object resolves to Relay Node interface's `id`.
**Example:**

View File

@ -25,7 +25,7 @@ query|subscription [<op-name>] {
```
| Key | Required | Schema | Description |
|-------------------|----------|---------------------------------------|---------------------------------------------------------------------------|
| ----------------- | -------- | ------------------------------------- | ------------------------------------------------------------------------- |
| op-name | false | Value | Name query/subscription for observability |
| connection-object | true | [ConnectionObject](#connectionobject) | Name of the table connection |
| argument | false | [Argument](#argument) | One or more filter criteria, instructions for sorting order or pagination |
@ -34,7 +34,7 @@ query|subscription [<op-name>] {
```graphql
query {
author_connection(first: 2){
author_connection(first: 2) {
pageInfo {
hasNextPage
endCursor
@ -74,7 +74,7 @@ subscription {
:::info Note
For details of usage, please see [this page](/graphql/core/databases/postgres/schema/relay-schema.mdx).
For details of usage, please see [this page](/schema/postgres/relay-schema.mdx).
:::
@ -108,7 +108,7 @@ connection-object {
```
| Field | Type |
|----------|------------------------|
| -------- | ---------------------- |
| pageInfo | [PageInfo](#pageinfo)! |
| edges | \[[Edge](#edge)!\]! |
@ -141,9 +141,8 @@ For more details on the Relay `PageInfo` object type, refer to the
### Edge {#edge}
Edge is an object type that consists of a [cursor](#cursor) and `node`
fields. `node` is a table object type which implements the Relay `Node`
interface.
Edge is an object type that consists of a [cursor](#cursor) and `node` fields. `node` is a table object type which
implements the Relay `Node` interface.
```graphql
type tableEdge {
@ -154,8 +153,7 @@ type tableEdge {
### Cursor {#cursor}
The cursor field returns a unique non-null String value which is useful
for [pagination](#paginationexp).
The cursor field returns a unique non-null String value which is useful for [pagination](#paginationexp).
:::info Note
@ -168,27 +166,30 @@ For more details on the Relay `cursor`, refer to the [Relay docs](https://relay.
<div className="parsed-literal">
<pre>
<code>
<a href="#relaydistinctonexp">DistinctOnExp</a>{` | `}
<a href="#relaywhereexp">WhereExp</a>{` | `}
<a href="#relayorderbyexp">OrderByExp</a>{` | `}
<a href="#relaypaginationexp">PaginationExp</a>
</code>
<code>
<a href='#relaydistinctonexp'>DistinctOnExp</a>
{` | `}
<a href='#relaywhereexp'>WhereExp</a>
{` | `}
<a href='#relayorderbyexp'>OrderByExp</a>
{` | `}
<a href='#relaypaginationexp'>PaginationExp</a>
</code>
</pre>
</div>
#### DistinctOnExp {#relaydistinctonexp}
Same as the generic [DistinctOnExp](/graphql/core/api-reference/graphql-api/query.mdx#distinctonexp)
Same as the generic [DistinctOnExp](/api-reference/graphql-api/query.mdx#distinctonexp)
#### WhereExp {#relaywhereexp}
Same as the generic [WhereExp](/graphql/core/api-reference/graphql-api/query.mdx#whereexp)
Same as the generic [WhereExp](/api-reference/graphql-api/query.mdx#whereexp)
#### OrderByExp {#relayorderbyexp}
Same as the generic [OrderByExp](/graphql/core/api-reference/graphql-api/query.mdx#orderbyexp)
Same as the generic [OrderByExp](/api-reference/graphql-api/query.mdx#orderbyexp)
#### PaginationExp {#relaypaginationexp}
@ -197,20 +198,19 @@ Same as the generic [OrderByExp](/graphql/core/api-reference/graphql-api/query.m
<div className="parsed-literal">
<pre>
<code>
{`first: Integer
[after: `}<a href="#cursor">Cursor</a>{`]`}
</code>
<code>
{`first: Integer
[after: `}
<a href='#cursor'>Cursor</a>
{`]`}
</code>
</pre>
</div>
```graphql
query {
article_connection(
first: 2
after: "eyJpZCIgOiAzfQ=="
){
article_connection(first: 2, after: "eyJpZCIgOiAzfQ==") {
pageInfo {
startCursor
endCursor
@ -234,20 +234,19 @@ query {
<div className="parsed-literal">
<pre>
<code>
{`[last: Integer]
[before: `}<a href="#cursor">Cursor</a>{`]`}
</code>
<code>
{`[last: Integer]
[before: `}
<a href='#cursor'>Cursor</a>
{`]`}
</code>
</pre>
</div>
```graphql
query {
article_connection(
last: 2
before: "eyJpZCIgOiA0fQ=="
){
article_connection(last: 2, before: "eyJpZCIgOiA0fQ==") {
pageInfo {
startCursor
endCursor
@ -256,7 +255,7 @@ query {
}
edges {
cursor
node{
node {
title
content
author_id

View File

@ -20,7 +20,7 @@ Users specify the query or mutation they wish to make available, as well
a URL template. Segments of the URL template can potentially capture
data to be used as GraphQL variables.
See [Metadata API Reference: RESTified GraphQL Endpoints](/graphql/core/api-reference/metadata-api/restified-endpoints.mdx) for information on how to work
See [Metadata API Reference: RESTified GraphQL Endpoints](/api-reference/metadata-api/restified-endpoints.mdx) for information on how to work
with endpoints through the metadata apis.
:::tip Supported from
@ -105,7 +105,7 @@ Content-Type: application/json
The response is determined by the saved query. The response will be the
same as if you had made the query directly in the GraphQL console.
See the [GraphQL API Reference](/graphql/core/api-reference/graphql-api/index.mdx) for more details.
See the [GraphQL API Reference](/api-reference/graphql-api/index.mdx) for more details.
## OpenAPI 3 Specification

View File

@ -23,7 +23,7 @@ Hasura schema.
:::tip Supported from
The schema API is supported for versions `v2.0.0` and above and replaces
the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::
@ -61,7 +61,7 @@ The various types of queries are listed in the following table:
| `type` | `args` | `version` | Synopsis |
|--------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|-----------|-----------------------------------------------|
| **bulk** | [Query](#schema-query) array | 1 | Execute multiple operations in a single query |
| [run_sql](/graphql/core/api-reference/schema-api/run-sql.mdx#schema-run-sql) | [run_sql_args](/graphql/core/api-reference/schema-api/run-sql.mdx#schema-run-sql-syntax) | 1 | Run SQL directly on Postgres |
| [run_sql](/api-reference/schema-api/run-sql.mdx#schema-run-sql) | [run_sql_args](/api-reference/schema-api/run-sql.mdx#schema-run-sql-syntax) | 1 | Run SQL directly on Postgres |
## Response structure
@ -88,4 +88,4 @@ not enabled i.e. remove it from the list of enabled APIs.
HASURA_GRAPHQL_ENABLED_APIS="graphql"
```
See [GraphQL Engine server config reference](/graphql/core/deployment/graphql-engine-flags/reference.mdx) for info on setting the above flag/env var.
See [GraphQL Engine server config reference](/deployment/graphql-engine-flags/reference.mdx) for info on setting the above flag/env var.

View File

@ -36,7 +36,7 @@ permissions on that particular view for various roles.
:::tip Supported from
The schema API is supported for versions `v2.0.0` and above and replaces
the older [schema/metadata API](/graphql/core/api-reference/schema-metadata-api/index.mdx).
the older [schema/metadata API](/api-reference/schema-metadata-api/index.mdx).
:::

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -68,8 +68,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------------|--------------------------|
| name | true | [ActionName](/graphql/core/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| definition | true | [ActionDefinition](/graphql/core/api-reference/syntax-defs.mdx#actiondefinition) | Definition of the action |
| name | true | [ActionName](/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| definition | true | [ActionDefinition](/api-reference/syntax-defs.mdx#actiondefinition) | Definition of the action |
| comment | false | text | comment |
## drop_action {#schema-metadata-drop-action}
@ -97,7 +97,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
| name | true | [ActionName](/graphql/core/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| name | true | [ActionName](/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| clear_data | false | boolean | If set to `true` and action kind is `asynchronous`, related data is deleted from catalog. (default: `true`) |
## update_action {#schema-metadata-update-action}
@ -140,8 +140,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------------|-----------------------------------------|
| name | true | [ActionName](/graphql/core/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| definition | true | [ActionDefinition](/graphql/core/api-reference/syntax-defs.mdx#actiondefinition) | Definition of the action to be replaced |
| name | true | [ActionName](/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| definition | true | [ActionDefinition](/api-reference/syntax-defs.mdx#actiondefinition) | Definition of the action to be replaced |
| comment | false | text | comment |
## create_action_permission {#schema-metadata-create-action-permission}
@ -167,8 +167,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|-----------------------------------------------------------------------|--------------------|
| action | true | [ActionName](/graphql/core/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Name of the role |
| action | true | [ActionName](/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Name of the role |
| comment | false | text | comment |
## drop_action_permission {#schema-metadata-drop-action-permission}
@ -193,5 +193,5 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------|----------|----------------------------------------------------------------------|--------------------|
| name | true | [ActionName](/graphql/core/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Name of the role |
| name | true | [ActionName](/api-reference/syntax-defs.mdx#actionname) | Name of the action |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Name of the role |

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -71,9 +71,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|---------------------------------------------------------------------------------------------------|--------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [ComputedFieldName](/graphql/core/api-reference/syntax-defs.mdx#computedfieldname) | Name of the new computed field |
| definition | true | [ComputedFieldDefinition](/graphql/core/api-reference/syntax-defs.mdx#computedfielddefinition) | The computed field definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [ComputedFieldName](/api-reference/syntax-defs.mdx#computedfieldname) | Name of the new computed field |
| definition | true | [ComputedFieldDefinition](/api-reference/syntax-defs.mdx#computedfielddefinition) | The computed field definition |
| comment | false | text | comment |
## drop_computed_field {#schema-metadata-drop-computed-field}
@ -108,6 +108,6 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|--------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [ComputedFieldName](/graphql/core/api-reference/syntax-defs.mdx#computedfieldname) | Name of the computed field |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [ComputedFieldName](/api-reference/syntax-defs.mdx#computedfieldname) | Name of the computed field |
| cascade | false | Boolean | When set to `true`, all the dependent items (if any) on this computed fields are also dropped |

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -36,7 +36,7 @@ querying/mutating/subscribing data over the GraphQL API.
`track_function` is used to add a custom SQL function to the `query`
root field of the GraphQL schema. Also refer a note
[here](/graphql/core/api-reference/syntax-defs.mdx#function-req-note).
[here](/api-reference/syntax-defs.mdx#function-req-note).
Add an SQL function `search_articles`:
@ -59,7 +59,7 @@ X-Hasura-Role: admin
Version 2 of `track_function` is used to add a custom SQL function to
the GraphQL schema. It supports more configuration options than v1, and
also supports tracking functions as mutations. Also refer a note
[here](/graphql/core/api-reference/syntax-defs.mdx#function-req-note).
[here](/api-reference/syntax-defs.mdx#function-req-note).
Track an SQL function called `search_articles` with a Hasura session
argument:
@ -133,8 +133,8 @@ default).
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------------------------------|------------------------------------|
| function | true | [FunctionName](/graphql/core/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |
| configuration | false | [Function Configuration](/graphql/core/api-reference/syntax-defs.mdx#function-configuration) | Configuration for the SQL function |
| function | true | [FunctionName](/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |
| configuration | false | [Function Configuration](/api-reference/syntax-defs.mdx#function-configuration) | Configuration for the SQL function |
## untrack_function {#schema-metadata-untrack-function}
@ -161,4 +161,4 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|--------------------------------------------------------------------------|--------------------------|
| table | true | [FunctionName](/graphql/core/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |
| table | true | [FunctionName](/api-reference/syntax-defs.mdx#functionname) | Name of the SQL function |

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -27,7 +27,7 @@ continue to function.
## Introduction
**Custom Types** are user-defined GraphQL types which help to define
[Actions](/graphql/core/api-reference/schema-metadata-api/actions.mdx).
[Actions](/api-reference/schema-metadata-api/actions.mdx).
## set_custom_types {#schema-metadata-set-custom-types}
@ -88,7 +88,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------|----------|------------------------------------------------------------------------------------------|-------------------------------|
| input_objects | false | Array of [InputObjectType](/graphql/core/api-reference/syntax-defs.mdx#inputobjecttype) | Set of GraphQL `Input Object` |
| objects | false | Array of [ObjectType](/graphql/core/api-reference/syntax-defs.mdx#objecttype) | Set of GraphQL `Object` |
| scalars | false | Array of [ScalarType](/graphql/core/api-reference/syntax-defs.mdx#scalartype) | Set of GraphQL `Scalar` |
| enums | false | Array of [EnumType](/graphql/core/api-reference/syntax-defs.mdx#enumtype) | Set of GraphQL `Enum` |
| input_objects | false | Array of [InputObjectType](/api-reference/syntax-defs.mdx#inputobjecttype) | Set of GraphQL `Input Object` |
| objects | false | Array of [ObjectType](/api-reference/syntax-defs.mdx#objecttype) | Set of GraphQL `Object` |
| scalars | false | Array of [ScalarType](/api-reference/syntax-defs.mdx#scalartype) | Set of GraphQL `Scalar` |
| enums | false | Array of [EnumType](/api-reference/syntax-defs.mdx#enumtype) | Set of GraphQL `Enum` |

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -78,15 +78,15 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| table | true | [QualifiedTable](/graphql/core/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| table | true | [QualifiedTable](/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| webhook | false | String | Full url of webhook (\*) |
| webhook_from_env | false | String | Environment variable name of webhook (must exist at boot time) (\*) |
| insert | false | [OperationSpec](/graphql/core/api-reference/syntax-defs.mdx#operationspec) | Specification for insert operation |
| update | false | [OperationSpec](/graphql/core/api-reference/syntax-defs.mdx#operationspec) | Specification for update operation |
| delete | false | [OperationSpec](/graphql/core/api-reference/syntax-defs.mdx#operationspec) | Specification for delete operation |
| headers | false | \[ [HeaderFromValue](/graphql/core/api-reference/syntax-defs.mdx#headerfromvalue) \| [HeaderFromEnv](/graphql/core/api-reference/syntax-defs.mdx#headerfromenv) \] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConf](/graphql/core/api-reference/syntax-defs.mdx#retryconf) | Retry configuration if event delivery fails |
| insert | false | [OperationSpec](/api-reference/syntax-defs.mdx#operationspec) | Specification for insert operation |
| update | false | [OperationSpec](/api-reference/syntax-defs.mdx#operationspec) | Specification for update operation |
| delete | false | [OperationSpec](/api-reference/syntax-defs.mdx#operationspec) | Specification for delete operation |
| headers | false | \[ [HeaderFromValue](/api-reference/syntax-defs.mdx#headerfromvalue) \| [HeaderFromEnv](/api-reference/syntax-defs.mdx#headerfromenv) \] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConf](/api-reference/syntax-defs.mdx#retryconf) | Retry configuration if event delivery fails |
| replace | false | Boolean | If set to true, the event trigger is replaced with the new definition |
| enable_manual | false | Boolean | If set to true, the event trigger can be invoked manually |
@ -113,7 +113,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------|----------|------------------------------------------------------------------------|---------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
## redeliver_event {#schema-metadata-redeliver-event}
@ -164,5 +164,5 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|------------------------------------------------------------------------|--------------------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the event trigger |
| payload | true | JSON | Some JSON payload to send to trigger |

View File

@ -0,0 +1,249 @@
---
description: Hasura schema/metadata API reference
keywords:
- hasura
- docs
- schema/metadata API
- API reference
slug: index
---
# Schema / Metadata API Reference (Deprecated)
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
:::
## Introduction
The schema / metadata API provides the following features:
1. Execute SQL on the underlying Postgres database, supports schema
modifying actions.
2. Modify Hasura metadata (permission rules and relationships).
This is primarily intended to be used as an `admin` API to manage the
Hasura schema and metadata.
## Endpoint
All requests are `POST` requests to the `/v1/query` endpoint.
## Request structure
```http
POST /v1/query HTTP/1.1
{
"type": "<query-type>",
"args": <args-object>
}
```
### Request body
<div className="parsed-literal">
<pre>
<code>
<a href="#schema-metadata-api-query">Query</a>
</code>
</pre>
</div>
#### Query {#schema-metadata-api-query}
| Key | Required | Schema | Description |
|---------|----------|------------|---------------------------------|
| type | true | String | Type of the query |
| args | true | JSON Value | The arguments to the query |
| version | false | Integer | Version of the API (default: 1) |
## Request types
The various types of queries are listed in the following table:
| `type` | `args` | `version` | Synopsis |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|------------------------------------------------------------------|
| **bulk** | [Query](#schema-metadata-api-query) array | 1 | Execute multiple operations in a single query |
| [run_sql](/api-reference/schema-metadata-api/run-sql.mdx#schema-metadata-run-sql) | [run_sql_args](/api-reference/schema-metadata-api/run-sql.mdx#schema-metadata-run-sql-syntax) | 1 | Run SQL directly on Postgres |
| [track_table](/api-reference/schema-metadata-api/table-view.mdx#schema-metadata-track-table) | [TableName](/api-reference/syntax-defs.mdx#tablename) | 1 | Add a table/view |
| [track_table](/api-reference/schema-metadata-api/table-view.mdx#schema-metadata-track-table-v2) | [track_table_args](/api-reference/schema-metadata-api/table-view.mdx#schema-metadata-track-table-syntax-v2) | 2 | Add a table/view with configuration |
| [set_table_customization](/api-reference/schema-metadata-api/table-view.mdx#schema-metadata-set-table-customization) | [set_table_customization_args](/api-reference/schema-metadata-api/table-view.mdx#schema-metadata-set-table-customization-syntax) | 1 | Set table customization of an already tracked table |
| [set_table_custom_fields (deprecated)](/api-reference/schema-metadata-api/table-view.mdx#schema-metadata-set-table-custom-fields) | [set_table_custom_fields_args](/api-reference/schema-metadata-api/table-view.mdx#schema-metadata-set-table-custom-fields-syntax) | 2 | Set custom fields of an already tracked table (deprecated) |
| [untrack_table](/api-reference/schema-metadata-api/table-view.mdx#schema-metadata-untrack-table) | [untrack_table_args](/api-reference/schema-metadata-api/table-view.mdx#schema-metadata-untrack-table-syntax) | 1 | Remove a table/view |
| [set_table_is_enum](/api-reference/schema-metadata-api/table-view.mdx#schema-metadata-set-table-is-enum) | [set_table_is_enum_args](/api-reference/schema-metadata-api/table-view.mdx#schema-metadata-set-table-is-enum-syntax) | 1 | Set a tracked table as an enum table |
| [track_function](/api-reference/schema-metadata-api/custom-functions.mdx#schema-metadata-track-function) | [FunctionName](/api-reference/syntax-defs.mdx#functionname) | 1 | Add an SQL function |
| [track_function](/api-reference/schema-metadata-api/custom-functions.mdx#schema-metadata-track-function-v2) | [track_function_args](/api-reference/schema-metadata-api/custom-functions.mdx#schema-metadata-track-function-syntax-v2) | 2 | Add an SQL function with configuration |
| [untrack_function](/api-reference/schema-metadata-api/custom-functions.mdx#schema-metadata-untrack-function) | [FunctionName](/api-reference/syntax-defs.mdx#functionname) | 1 | Remove an SQL function |
| [create_object_relationship](/api-reference/schema-metadata-api/relationship.mdx#schema-metadata-create-object-relationship) | [create_object_relationship_args](/api-reference/schema-metadata-api/relationship.mdx#schema-metadata-create-object-relationship-syntax) | 1 | Define a new object relationship |
| [create_array_relationship](/api-reference/schema-metadata-api/relationship.mdx#schema-metadata-create-array-relationship) | [create_array_relationship_args](/api-reference/schema-metadata-api/relationship.mdx#schema-metadata-create-array-relationship-syntax) | 1 | Define a new array relationship |
| [drop_relationship](/api-reference/schema-metadata-api/relationship.mdx#schema-metadata-drop-relationship) | [drop_relationship_args](/api-reference/schema-metadata-api/relationship.mdx#schema-metadata-drop-relationship-syntax) | 1 | Drop an existing relationship |
| [rename_relationship](/api-reference/schema-metadata-api/relationship.mdx#schema-metadata-rename-relationship) | [rename_relationship_args](/api-reference/schema-metadata-api/relationship.mdx#schema-metadata-rename-relationship-syntax) | 1 | Modify name of an existing relationship |
| [set_relationship_comment](/api-reference/schema-metadata-api/relationship.mdx#schema-metadata-set-relationship-comment) | [set_relationship_comment_args](/api-reference/schema-metadata-api/relationship.mdx#schema-metadata-set-relationship-comment-syntax) | 1 | Set comment on an existing relationship |
| [add_computed_field](/api-reference/schema-metadata-api/computed-field.mdx#schema-metadata-add-computed-field) | [add_computed_field_args](/api-reference/schema-metadata-api/computed-field.mdx#schema-metadata-add-computed-field-syntax) | 1 | Add a computed field |
| [drop_computed_field](/api-reference/schema-metadata-api/computed-field.mdx#schema-metadata-drop-computed-field) | [drop_computed_field_args](/api-reference/schema-metadata-api/computed-field.mdx#schema-metadata-drop-computed-field-syntax) | 1 | Drop a computed field |
| [create_insert_permission](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-create-insert-permission) | [create_insert_permission_args](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-create-insert-permission-syntax) | 1 | Specify insert permission |
| [drop_insert_permission](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-drop-insert-permission) | [drop_insert_permission_args](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-drop-insert-permission-syntax) | 1 | Remove existing insert permission |
| [create_select_permission](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-create-select-permission) | [create_select_permission_args](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-create-select-permission-syntax) | 1 | Specify select permission |
| [drop_select_permission](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-drop-select-permission) | [drop_select_permission_args](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-drop-select-permission-syntax) | 1 | Remove existing select permission |
| [create_update_permission](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-create-update-permission) | [create_update_permission_args](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-create-update-permission-syntax) | 1 | Specify update permission |
| [drop_update_permission](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-drop-update-permission) | [drop_update_permission_args](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-drop-update-permission-syntax) | 1 | Remove existing update permission |
| [create_delete_permission](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-create-delete-permission) | [create_delete_permission_args](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-create-delete-permission-syntax) | 1 | Specify delete permission |
| [drop_delete_permission](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-drop-delete-permission) | [drop_delete_permission_args](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-drop-delete-permission-syntax) | 1 | Remove existing delete permission |
| [set_permission_comment](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-set-permission-comment) | [set_permission_comment_args](/api-reference/schema-metadata-api/permission.mdx#schema-metadata-set-permission-comment-syntax) | 1 | Set comment on an existing permission |
| [create_event_trigger](/api-reference/schema-metadata-api/event-triggers.mdx#schema-metadata-create-event-trigger) | [create_event_trigger_args](/api-reference/schema-metadata-api/event-triggers.mdx#schema-metadata-create-event-trigger-syntax) | 1 | Create or replace an event trigger |
| [delete_event_trigger](/api-reference/schema-metadata-api/event-triggers.mdx#schema-metadata-delete-event-trigger) | [delete_event_trigger_args](/api-reference/schema-metadata-api/event-triggers.mdx#schema-metadata-delete-event-trigger-syntax) | 1 | Delete an existing event trigger |
| [redeliver_event](/api-reference/schema-metadata-api/event-triggers.mdx#schema-metadata-redeliver-event) | [redeliver_event_args](/api-reference/schema-metadata-api/event-triggers.mdx#schema-metadata-redeliver-event-syntax) | 1 | Redeliver an existing event |
| [invoke_event_trigger](/api-reference/schema-metadata-api/event-triggers.mdx#schema-metadata-invoke-event-trigger) | [invoke_event_trigger_args](/api-reference/schema-metadata-api/event-triggers.mdx#schema-metadata-invoke-event-trigger-syntax) | 1 | Invoke a trigger with custom payload |
| [create_cron_trigger](/api-reference/schema-metadata-api/scheduled-triggers.mdx#schema-metadata-create-cron-trigger) | [create_cron_trigger_args](/api-reference/schema-metadata-api/scheduled-triggers.mdx#schema-metadata-create-cron-trigger-syntax) | 1 | Create a cron trigger |
| [delete_cron_trigger](/api-reference/schema-metadata-api/scheduled-triggers.mdx#schema-metadata-delete-cron-trigger) | [delete_cron_trigger_args](/api-reference/schema-metadata-api/scheduled-triggers.mdx#schema-metadata-delete-cron-trigger-syntax) | 1 | Delete an existing cron trigger |
| [get_cron_triggers](/api-reference/metadata-api/scheduled-triggers.mdx#metadata-get-cron-triggers) | [Empty Object](/api-reference/syntax-defs.mdx#empty-object) | 1 | Fetch all the cron triggers |
| [create_scheduled_event](/api-reference/schema-metadata-api/scheduled-triggers.mdx#schema-metadata-create-scheduled-event) | [create_scheduled_event_args](/api-reference/schema-metadata-api/scheduled-triggers.mdx#schema-metadata-create-scheduled-event-syntax) | 1 | Create a new scheduled event |
| [add_remote_schema](/api-reference/schema-metadata-api/remote-schemas.mdx#schema-metadata-add-remote-schema) | [add_remote_schema_args](/api-reference/schema-metadata-api/remote-schemas.mdx#schema-metadata-add-remote-schema-syntax) | 1 | Add a remote GraphQL server as a remote schema |
| [update_remote_schema](/api-reference/schema-metadata-api/remote-schemas.mdx#schema-metadata-update-remote-schema) | [update_remote_schema_args](/api-reference/schema-metadata-api/remote-schemas.mdx#schema-metadata-update-remote-schema-syntax) | 1 | Update the details for a remote schema |
| [remove_remote_schema](/api-reference/schema-metadata-api/remote-schemas.mdx#schema-metadata-remove-remote-schema) | [remove_remote_schema_args](/api-reference/schema-metadata-api/remote-schemas.mdx#schema-metadata-remove-remote-schema-syntax) | 1 | Remove an existing remote schema |
| [reload_remote_schema](/api-reference/schema-metadata-api/remote-schemas.mdx#schema-metadata-reload-remote-schema) | [reload_remote_schema_args](/api-reference/schema-metadata-api/remote-schemas.mdx#schema-metadata-reload-remote-schema-syntax) | 1 | Reload schema of an existing remote schema |
| [add_remote_schema_permissions](/api-reference/schema-metadata-api/remote-schema-permissions.mdx#schema-metadata-add-remote-schema-permissions) | [add_remote_schema_permissions](/api-reference/schema-metadata-api/remote-schema-permissions.mdx#schema-metadata-add-remote-schema-permissions-syntax) | 1 | Add permissions to a role of an existing remote schema |
| [drop_remote_schema_permissions](/api-reference/schema-metadata-api/remote-schema-permissions.mdx#schema-metadata-drop-remote-schema-permissions)| [drop_remote_schema_permissions](/api-reference/schema-metadata-api/remote-schema-permissions.mdx#schema-metadata-drop-remote-schema-permissions-syntax) | 1 | Drop existing permissions defined for a role for a remote schema |
| [create_remote_relationship](/api-reference/schema-metadata-api/remote-relationships.mdx#schema-metadata-create-remote-relationship) | [create_remote_relationship_args](/api-reference/schema-metadata-api/remote-relationships.mdx#schema-metadata-create-remote-relationship-syntax) | 1 | Create a remote relationship with an existing remote schema |
| [update_remote_relationship](/api-reference/schema-metadata-api/remote-relationships.mdx#schema-metadata-update-remote-relationship) | [update_remote_relationship_args](/api-reference/schema-metadata-api/remote-relationships.mdx#schema-metadata-update-remote-relationship-syntax) | 1 | Update an existing remote relationship |
| [delete_remote_relationship](/api-reference/schema-metadata-api/remote-relationships.mdx#schema-metadata-delete-remote-relationship) | [delete_remote_relationship_args](/api-reference/schema-metadata-api/remote-relationships.mdx#schema-metadata-delete-remote-relationship-syntax) | 1 | Delete an existing remote relationship |
| [export_metadata](/api-reference/schema-metadata-api/manage-metadata.mdx#schema-metadata-export-metadata) | [Empty Object](/api-reference/syntax-defs.mdx#empty-object) | 1 | Export the current metadata |
| [replace_metadata](/api-reference/schema-metadata-api/manage-metadata.mdx#schema-metadata-replace-metadata) | [replace_metadata_args](/api-reference/schema-metadata-api/manage-metadata.mdx#schema-metadata-replace-metadata-syntax) | 1 | Import and replace existing metadata |
| [reload_metadata](/api-reference/schema-metadata-api/manage-metadata.mdx#schema-metadata-reload-metadata) | [reload_metadata_args](/api-reference/schema-metadata-api/manage-metadata.mdx#schema-metadata-reload-metadata-syntax) | 1 | Reload changes to the underlying Postgres DB |
| [clear_metadata](/api-reference/schema-metadata-api/manage-metadata.mdx#schema-metadata-clear-metadata) | [Empty Object](/api-reference/syntax-defs.mdx#empty-object) | 1 | Clear/wipe-out the current metadata state form server |
| [get_inconsistent_metadata](/api-reference/schema-metadata-api/manage-metadata.mdx#schema-metadata-get-inconsistent-metadata) | [Empty Object](/api-reference/syntax-defs.mdx#empty-object) | 1 | List all inconsistent metadata objects |
| [drop_inconsistent_metadata](/api-reference/schema-metadata-api/manage-metadata.mdx#schema-metadata-drop-inconsistent-metadata) | [Empty Object](/api-reference/syntax-defs.mdx#empty-object) | 1 | Drop all inconsistent metadata objects |
| [create_query_collection](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-create-query-collection) | [create_query_collection_args](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-create-query-collection-syntax) | 1 | Create a query collection |
| [drop_query_collection](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-drop-query-collection) | [drop_query_collection_args](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-drop-query-collection-syntax) | 1 | Drop a query collection |
| [add_query_to_collection](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-add-query-to-collection) | [add_query_to_collection_args](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-add-query-to-collection-syntax) | 1 | Add a query to a given collection |
| [drop_query_from_collection](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-drop-query-from-collection) | [drop_query_from_collection_args](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-drop-query-from-collection-syntax) | 1 | Drop a query from a given collection |
| [add_collection_to_allowlist](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-add-collection-to-allowlist) | [add_collection_to_allowlist_args](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-add-collection-to-allowlist-syntax) | 1 | Add a collection to the allow-list |
| [drop_collection_from_allowlist](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-drop-collection-from-allowlist) | [drop_collection_from_allowlist_args](/api-reference/schema-metadata-api/query-collections.mdx#schema-metadata-drop-collection-from-allowlist-syntax) | 1 | Drop a collection from the allow-list |
| [set_custom_types](/api-reference/schema-metadata-api/custom-types.mdx#schema-metadata-set-custom-types) | [set_custom_types_args](/api-reference/schema-metadata-api/custom-types.mdx#schema-metadata-set-custom-types-syntax) | 1 | Set custom GraphQL types |
| [create_action](/api-reference/schema-metadata-api/actions.mdx#schema-metadata-create-action) | [create_action_args](/api-reference/schema-metadata-api/actions.mdx#schema-metadata-create-action-syntax) | 1 | Create an action |
| [drop_action](/api-reference/schema-metadata-api/actions.mdx#schema-metadata-drop-action) | [drop_action_args](/api-reference/schema-metadata-api/actions.mdx#schema-metadata-drop-action-syntax) | 1 | Drop an action |
| [update_action](/api-reference/schema-metadata-api/actions.mdx#schema-metadata-update-action) | [update_action_args](/api-reference/schema-metadata-api/actions.mdx#schema-metadata-update-action-syntax) | 1 | Update an action |
| [create_action_permission](/api-reference/schema-metadata-api/actions.mdx#schema-metadata-create-action-permission) | [create_action_permission_args](/api-reference/schema-metadata-api/actions.mdx#schema-metadata-create-action-permission-syntax) | 1 | Create an action permission |
| [drop_action_permission](/api-reference/schema-metadata-api/actions.mdx#schema-metadata-drop-action-permission) | [drop_action_permission_args](/api-reference/schema-metadata-api/actions.mdx#schema-metadata-drop-action-permission-syntax) | 1 | Drop an action permission |
| [create_rest_endpoint](/api-reference/schema-metadata-api/restified-endpoints.mdx#schema-metadata-create-rest-endpoint) | [create_rest_endpoint_args](/api-reference/schema-metadata-api/restified-endpoints.mdx#schema-metadata-create-rest-endpoint-syntax) | 3 | Create a RESTified GraphQL Endpoint |
| [drop_rest_endpoint](/api-reference/schema-metadata-api/restified-endpoints.mdx#schema-metadata-drop-rest-endpoint) | [drop_rest_endpoint_args](/api-reference/schema-metadata-api/restified-endpoints.mdx#schema-metadata-drop-rest-endpoint-syntax) | 3 | Drop a RESTified GraphQL Endpoint |
**See:**
- [Run SQL](/api-reference/schema-metadata-api/run-sql.mdx)
- [Tables/Views](/api-reference/schema-metadata-api/table-view.mdx)
- [Custom SQL Functions](/api-reference/schema-metadata-api/custom-functions.mdx)
- [Relationships](/api-reference/schema-metadata-api/relationship.mdx)
- [Computed Fields](/api-reference/schema-metadata-api/computed-field.mdx)
- [Permissions](/api-reference/schema-metadata-api/permission.mdx)
- [Remote Schema Permissions](/api-reference/schema-metadata-api/remote-schema-permissions.mdx)
- [Event Triggers](/api-reference/schema-metadata-api/event-triggers.mdx)
- [Remote Schemas](/api-reference/schema-metadata-api/remote-schemas.mdx)
- [Query Collections](/api-reference/schema-metadata-api/query-collections.mdx)
- [Custom Types](/api-reference/schema-metadata-api/custom-types.mdx)
- [Actions](/api-reference/schema-metadata-api/actions.mdx)
- [Manage Metadata](/api-reference/schema-metadata-api/manage-metadata.mdx)
## Response structure
| Status code | Description | Response structure |
|--------------|-------------------------|--------------------------------------------|
| 200 | Success | Request specific |
| 400 | Bad request | `{"path" : String, "error" : String}` |
| 401 | Unauthorized | `{"error" : String}` |
| 500 | Internal server error | `{"error" : String}` |
## Error codes
| Status Code | Code | Error |
| ----------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| 400 | postgres-error | Not-NULL violation. null value in column `<column-name>` violates not-null constraint |
| 400 | permission-denied | select on `<column/table>` for role `<role-name>` is not allowed. |
| 400 | not-exists | table `<table-name>` does not exist |
| 400 | not-exists | no such table/view exists in source : `<table-name>` |
| 400 | not-exists | `<field-name>` does not exist |
| 400 | already-tracked | view/table already tracked : `<table-name>` |
| 400 | access-denied | restricted access : admin only |
| 400 | not-supported | table renames are not yet supported : `<table-name>` |
| 400 | not-exists | `<column-name>` does not exist |
| 400 | already-exists | cannot add column `<column-name>` in table `<table-name>` as a relationship with the name already exists |
| 400 | invalid-json | invalid json |
| 400 | not-supported | column renames are not yet supported : `<table-name>`.`<column-name>` |
| 400 | invalid-headers | missing header : `<header-name>` |
| 400 | dependency-error | cannot change type of column `<column-name>` in table `<table-name>` because of the following dependencies : `<dependencies>` |
| 400 | invalid-headers | X-Hasura-User-Id should be an integer |
| 400 | dependency-error | cannot drop due to the following dependent objects : `<dependencies>` |
| 400 | access-denied | You have to be admin to access this endpoint |
| 400 | parse-failed | parsing dotted table failed : `<table-name>` |
| 400 | access-denied | not authorised to access this tx |
| 400 | already-exists | multiple declarations exist for the following `<table-name>` : `<duplicates>` |
| 400 | not-exists | tx does not exists |
| 400 | already-exists | column/relationship of table `<table-name>` already exists |
| 400 | already-initialised | the state seems to be initialised already. \ \ you may need to migrate from this version: `<catalog-version>` |
| 400 | constraint-error | no foreign constraint exists on the given column |
| 400 | not-supported | unsupported version : `<catalog-version>` |
| 400 | constraint-error | more than one foreign key constraint exists on the given column |
| 400 | already-exists | the query template already exists `<template-name>` |
| 400 | permission-error | `<permission-type>`' permission on `<table-name>` for role `<role-name>` already exists |
| 400 | permission-error | `<permission-type>`' permission on `<table-name>` for role `<role-name>` does not exist |
| 400 | unexpected-payload | Unknown operator : `<operator-type>` |
| 400 | unexpected-payload | expecting a string for column operator |
| 400 | unexpected-payload | incompatible column types : '`<column-name>`', '`<column-name>`' |
| 400 | unexpected-payload | Expecting 'constraint' or 'constraint_on' when the 'action' is 'update' |
| 400 | unexpected-payload | constraint' and 'constraint_on' cannot be set at a time |
| 400 | unexpected-payload | upsert is not allowed for role '`<role-name>`' |
| 400 | unexpected-payload | objects should not be empty |
| 400 | invalid-params | missing parameter : `<param-name>` |
| 400 | unexpected-payload | can't be empty |
| 400 | | `<col-name>` is a relationship and should be expanded |
| 400 | unexpected-payload | `<column-name>`' should be included in 'columns' |
| 400 | unexpected-payload | `<column-name>`' is an array relationship and can't be used in 'order_by' |
| 400 | | `<column-name>`' is a Postgres column and cannot be chained further |
| 400 | unexpected-payload | order_by array should not be empty |
| 400 | unexpected-payload | when selecting an 'obj_relationship' 'where', 'order_by', 'limit' and 'offset' can't be used |
| 400 | unexpected-payload | atleast one of $set, $inc, $mul has to be present |
| 400 | permission-denied | `<permission-type>` on `<table-name>` for role `<role-name>` is not allowed |
| 400 | not-exists | no such column exists : `<column-name>` |
| 400 | permission-denied | role `<role-name>` does not have permission to `<permission-type>` column `<column-name>` |
| 400 | | expecting a postgres column; but, `<name>` is relationship |
| 400 | unexpected-payload | JSON column can not be part of where clause |
| 400 | unexpected-payload | is of type `<type-name>`; this operator works only on column of types `<[types]>` |
| 400 | postgres-error | query execution failed |
| 500 | unexpected | unexpected dependency of relationship : `<dependency>` |
| 500 | unexpected | unexpected dependent object : `<dependency>` |
| 500 | unexpected | field already exists |
| 500 | unexpected | field does not exist |
| 500 | unexpected | permission does not exist |
| 500 | postgres-error | postgres transaction error |
| 500 | postgres-error | connection error |
| 500 | postgres-error | postgres query error |
| 404 | not-found | No such resource exists |
## Disabling schema / metadata API
Since this API can be used to make changes to the GraphQL schema, it can
be disabled, especially in production deployments.
The `enabled-apis` flag or the `HASURA_GRAPHQL_ENABLED_APIS` env var can
be used to enable/disable this API. By default, the schema/metadata API
is enabled. To disable it, you need to explicitly state that this API is
not enabled i.e. remove it from the list of enabled APIs.
```bash
# enable only graphql api, disable metadata and pgdump
--enabled-apis="graphql"
HASURA_GRAPHQL_ENABLED_APIS="graphql"
```
See [GraphQL Engine server config reference](/deployment/graphql-engine-flags/reference.mdx) for info on setting the above flag/env var.

View File

@ -16,8 +16,8 @@ toc_max_heading_level: 2
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -48,7 +48,7 @@ Response:
The response JSON will be the metadata object. The structure of the
metadata object is just a JSON version of the
[metadata files](/graphql/core/migrations/config-v2/reference/metadata-format.mdx) generated by the CLI.
[metadata files](/migrations-metadata-seeds/legacy-configs/config-v2/reference/metadata-format.mdx) generated by the CLI.
## replace_metadata {#schema-metadata-replace-metadata}
@ -170,7 +170,7 @@ If the metadata is not consistent:
| Key | Required | Schema | Description |
|-----------------------|----------|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| reload_remote_schemas | false | `Boolean` \| \[[RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname)\] | If set to `true`, all remote schemas' (including inconsistent ones) cached GraphQL schemas are refreshed (default: `true`) |
| reload_remote_schemas | false | `Boolean` \| \[[RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname)\] | If set to `true`, all remote schemas' (including inconsistent ones) cached GraphQL schemas are refreshed (default: `true`) |
## clear_metadata {#schema-metadata-clear-metadata}

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -125,9 +125,9 @@ In the above definition, the row is allowed to be inserted if the
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|---------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [InsertPermission](/graphql/core/api-reference/syntax-defs.mdx#insertpermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [InsertPermission](/api-reference/syntax-defs.mdx#insertpermission) | The permission definition |
| comment | false | text | Comment |
## drop_insert_permission {#schema-metadata-drop-insert-permission}
@ -155,8 +155,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|--------------------------------------------------------------------|-------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
## create_select_permission {#schema-metadata-create-select-permission}
@ -207,9 +207,9 @@ This reads as follows - For the `user` role:
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|---------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [SelectPermission](/graphql/core/api-reference/syntax-defs.mdx#selectpermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [SelectPermission](/api-reference/syntax-defs.mdx#selectpermission) | The permission definition |
| comment | false | text | Comment |
## drop_select_permission {#schema-metadata-drop-select-permission}
@ -237,8 +237,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|--------------------------------------------------------------------|-------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
## create_update_permission {#schema-metadata-create-update-permission}
@ -302,9 +302,9 @@ never be allowed to be updated.
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|---------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [UpdatePermission](/graphql/core/api-reference/syntax-defs.mdx#updatepermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [UpdatePermission](/api-reference/syntax-defs.mdx#updatepermission) | The permission definition |
| comment | false | text | Comment |
## drop_update_permission {#schema-metadata-drop-update-permission}
@ -332,8 +332,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|--------------------------------------------------------------------|-------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
## create_delete_permission {#schema-metadata-create-delete-permission}
@ -370,9 +370,9 @@ value."
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|---------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [DeletePermission](/graphql/core/api-reference/syntax-defs.mdx#deletepermission) | The permission definition |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| permission | true | [DeletePermission](/api-reference/syntax-defs.mdx#deletepermission) | The permission definition |
| comment | false | text | Comment |
## drop_delete_permission {#schema-metadata-drop-delete-permission}
@ -400,8 +400,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|--------------------------------------------------------------------|-------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
## set_permission_comment {#schema-metadata-set-permission-comment}
@ -431,7 +431,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------|----------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | The role in the permission |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | The role in the permission |
| type | true | permission type (one of select/update/delete/insert) | The type of the permission |
| comment | false | Text | Comment |

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -66,8 +66,8 @@ As the query collection is used in allowlists and REST endpoints, they are valid
| Key | Required | Schema | Description |
|------------|----------|---------------------------------------------------------------------------------------|------------------------------|
| name | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| definition | true | [CollectionQuery](/graphql/core/api-reference/syntax-defs.mdx#collectionquery) array | List of queries |
| name | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| definition | true | [CollectionQuery](/api-reference/syntax-defs.mdx#collectionquery) array | List of queries |
| comment | false | text | Optional comment |
## drop_query_collection {#schema-metadata-drop-query-collection}
@ -92,7 +92,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
| collection | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| collection | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| cascade | true | boolean | When set to `true`, the collection (if present) is removed from the allowlist |
## add_query_to_collection {#schema-metadata-add-query-to-collection}
@ -118,8 +118,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------------|----------|------------------------------------------------------------------------------|------------------------------|
| collection_name | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| query_name | true | [QueryName](/graphql/core/api-reference/syntax-defs.mdx#queryname) | Name of the query |
| collection_name | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| query_name | true | [QueryName](/api-reference/syntax-defs.mdx#queryname) | Name of the query |
| query | true | text | The GraphQL query text |
## drop_query_from_collection {#schema-metadata-drop-query-from-collection}
@ -145,8 +145,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-----------------|----------|------------------------------------------------------------------------------|------------------------------|
| collection_name | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| query_name | true | [QueryName](/graphql/core/api-reference/syntax-defs.mdx#queryname) | Name of the query |
| collection_name | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of the query collection |
| query_name | true | [QueryName](/api-reference/syntax-defs.mdx#queryname) | Name of the query |
## add_collection_to_allowlist {#schema-metadata-add-collection-to-allowlist}
@ -169,7 +169,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|------------------------------------------------------------------------------|----------------------------------------------------------|
| collection | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of a query collection to be added to the allow-list |
| collection | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of a query collection to be added to the allow-list |
## drop_collection_from_allowlist {#schema-metadata-drop-collection-from-allowlist}
@ -192,4 +192,4 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|------------------------------------------------------------------------------|--------------------------------------------------------------|
| collection | true | [CollectionName](/graphql/core/api-reference/syntax-defs.mdx#collectionname) | Name of a query collection to be removed from the allow-list |
| collection | true | [CollectionName](/api-reference/syntax-defs.mdx#collectionname) | Name of a query collection to be removed from the allow-list |

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -166,9 +166,9 @@ defined on `article` table's `id` column to `article_detail` view's
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------------------|----------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ObjRelUsing](/graphql/core/api-reference/syntax-defs.mdx#objrelusing) | Use one of the available ways to define an object relationship |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ObjRelUsing](/api-reference/syntax-defs.mdx#objrelusing) | Use one of the available ways to define an object relationship |
| comment | false | text | comment |
## create_array_relationship {#schema-metadata-create-array-relationship}
@ -255,9 +255,9 @@ defined on the `author` table's `id` column to `article_detail` view's
| Key | Required | Schema | Description |
|---------|----------|----------------------------------------------------------------------------------|---------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ArrRelUsing](/graphql/core/api-reference/syntax-defs.mdx#arrrelusing) | Use one of the available ways to define an array relationship |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | Name of the new relationship |
| using | true | [ArrRelUsing](/api-reference/syntax-defs.mdx#arrrelusing) | Use one of the available ways to define an array relationship |
| comment | false | text | comment |
## drop_relationship {#schema-metadata-drop-relationship}
@ -288,8 +288,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------------|----------|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | Name of the relationship that needs to be dropped |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | Name of the relationship that needs to be dropped |
| cascade | false | Boolean | When set to `true`, all the dependent items on this relationship are also dropped |
:::info Note
@ -325,8 +325,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|--------------|----------|-------------------------------------------------------------------------------------|-------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| relationship | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| comment | false | Text | Comment |
## rename_relationship {#schema-metadata-rename-relationship}
@ -354,6 +354,6 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|----------|----------|----------------------------------------------------------------------------------|-----------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| new_name | true | [RelationshipName](/graphql/core/api-reference/syntax-defs.mdx#relationshipname) | New relationship name |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | The relationship |
| new_name | true | [RelationshipName](/api-reference/syntax-defs.mdx#relationshipname) | New relationship name |

View File

@ -16,8 +16,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -61,11 +61,11 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| table | true | [QualifiedTable](/graphql/core/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| hasura_fields | true | \[[PGColumn](/graphql/core/api-reference/syntax-defs.mdx#pgcolumn) \| [ComputedFieldName](/graphql/core/api-reference/syntax-defs.mdx#computedfieldname)] | Column/Computed field(s) in the table that is used for joining with remote schema field. All join keys in `remote_field` must appear here. |
| remote_schema | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema to join with |
| remote_field | true | [RemoteField](/graphql/core/api-reference/syntax-defs.mdx#remotefield) | The schema tree ending at the field in remote schema which needs to be joined with. |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| table | true | [QualifiedTable](/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| hasura_fields | true | \[[PGColumn](/api-reference/syntax-defs.mdx#pgcolumn) \| [ComputedFieldName](/api-reference/syntax-defs.mdx#computedfieldname)] | Column/Computed field(s) in the table that is used for joining with remote schema field. All join keys in `remote_field` must appear here. |
| remote_schema | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema to join with |
| remote_field | true | [RemoteField](/api-reference/syntax-defs.mdx#remotefield) | The schema tree ending at the field in remote schema which needs to be joined with. |
## update_remote_relationship {#schema-metadata-update-remote-relationship}
@ -101,11 +101,11 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------|----------|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| table | true | [QualifiedTable](/graphql/core/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| hasura_fields | true | \[[PGColumn](/graphql/core/api-reference/syntax-defs.mdx#pgcolumn)\] | Column(s) in the table that is used for joining with remote schema field. All join keys in `remote_field` must appear here. |
| remote_schema | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema to join with |
| remote_field | true | [RemoteField](/graphql/core/api-reference/syntax-defs.mdx#remotefield) | The schema tree ending at the field in remote schema which needs to be joined with. |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| table | true | [QualifiedTable](/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| hasura_fields | true | \[[PGColumn](/api-reference/syntax-defs.mdx#pgcolumn)\] | Column(s) in the table that is used for joining with remote schema field. All join keys in `remote_field` must appear here. |
| remote_schema | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema to join with |
| remote_field | true | [RemoteField](/api-reference/syntax-defs.mdx#remotefield) | The schema tree ending at the field in remote schema which needs to be joined with. |
## delete_remote_relationship {#schema-metadata-delete-remote-relationship}
@ -132,5 +132,5 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|-------------------------------------------------------------------------------------------------------|-----------------------------------|
| table | true | [QualifiedTable](/graphql/core/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| name | true | [RemoteRelationshipName](/graphql/core/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |
| table | true | [QualifiedTable](/api-reference/syntax-defs.mdx#qualifiedtable) | Object with table name and schema |
| name | true | [RemoteRelationshipName](/api-reference/syntax-defs.mdx#remoterelationshipname) | Name of the remote relationship |

View File

@ -16,8 +16,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -194,7 +194,7 @@ fields during execution. This way the field is executed with limited
input values. Argument presets are of two types:
1. Static Value
2. [Session Variable](/graphql/core/auth/authorization/roles-variables.mdx#dynamic-session-variables)
2. [Session Variable](/auth/authorization/roles-variables.mdx#dynamic-session-variables)
A preset value can be added to an input value via the `@preset`
directive.
@ -223,7 +223,7 @@ before querying the remote schema.
:::info Note
By default, if the input value preset contains a
[session variable value](/graphql/core/auth/authorization/roles-variables.mdx#dynamic-session-variables), then its value
[session variable value](/auth/authorization/roles-variables.mdx#dynamic-session-variables), then its value
will be resolved when the query is executed. To treat the session
variable value as a literal value (avoiding resolving of the session
variable value) can be done by specifying `static` as `true` while
@ -339,9 +339,9 @@ engine before it queries the remote schema.
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------------------------------|-----------------------------------------|
| remote_schema | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| definition | true | [RemoteSchemaPermission](/graphql/core/api-reference/syntax-defs.mdx#remoteschemapermission) | The remote schema permission definition |
| remote_schema | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |
| definition | true | [RemoteSchemaPermission](/api-reference/syntax-defs.mdx#remoteschemapermission) | The remote schema permission definition |
| comment | false | text | Comment |
:::info Note
@ -379,5 +379,5 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------|----------|-----------------------------------------------------------------------------------|---------------------------|
| table | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| role | true | [RoleName](/graphql/core/api-reference/syntax-defs.mdx#rolename) | Role |
| table | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| role | true | [RoleName](/api-reference/syntax-defs.mdx#rolename) | Role |

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -57,8 +57,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|----------------------------------|
| name | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| definition | true | [RemoteSchemaDef](/graphql/core/api-reference/syntax-defs.mdx#remoteschemadef) | Definition for the remote schema |
| name | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| definition | true | [RemoteSchemaDef](/api-reference/syntax-defs.mdx#remoteschemadef) | Definition for the remote schema |
| comment | false | Text | comment |
@ -97,8 +97,8 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-----------------------------------------------------------------------------------|----------------------------------|
| name | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| definition | true | [RemoteSchemaDef](/graphql/core/api-reference/syntax-defs.mdx#remoteschemadef) | Definition for the remote schema |
| name | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| definition | true | [RemoteSchemaDef](/api-reference/syntax-defs.mdx#remoteschemadef) | Definition for the remote schema |
| comment | false | Text | comment |
@ -126,7 +126,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------|----------|----------------------------------------------------------------------------------|---------------------------|
| name | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| name | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
## reload_remote_schema {#schema-metadata-reload-remote-schema}
@ -153,4 +153,4 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------|----------|----------------------------------------------------------------------------------|---------------------------|
| name | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |
| name | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema |

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -60,9 +60,9 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------------|----------|-------------------|---------------------------------------------------------|
| name | true | Text | A unique identifier for the endpoint |
| url | true | [EndpointUrl](/graphql/core/api-reference/syntax-defs.mdx#endpointurl) | URL of the REST endpoint |
| methods | true | [EndpointMethods](/graphql/core/api-reference/syntax-defs.mdx#endpointmethods) | Non-Empty case sensitive list of supported HTTP Methods |
| definition | true | [EndpointDefinition](/graphql/core/api-reference/syntax-defs.mdx#endpointdef) | Definition for the REST endpoint |
| url | true | [EndpointUrl](/api-reference/syntax-defs.mdx#endpointurl) | URL of the REST endpoint |
| methods | true | [EndpointMethods](/api-reference/syntax-defs.mdx#endpointmethods) | Non-Empty case sensitive list of supported HTTP Methods |
| definition | true | [EndpointDefinition](/api-reference/syntax-defs.mdx#endpointdef) | Definition for the REST endpoint |
| comment | false | Text | comment |
:::tip Supported from

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.

View File

@ -15,8 +15,8 @@ keywords:
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
@ -57,12 +57,12 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|---------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the cron trigger |
| webhook | true | [WebhookURL](/graphql/core/api-reference/syntax-defs.mdx#webhookurl) | URL of the webhook |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the cron trigger |
| webhook | true | [WebhookURL](/api-reference/syntax-defs.mdx#webhookurl) | URL of the webhook |
| schedule | true | Cron Expression | Cron expression at which the trigger should be invoked. |
| payload | false | JSON | Any JSON payload which will be sent when the webhook is invoked. |
| headers | false | \[[HeaderFromValue](/graphql/core/api-reference/syntax-defs.mdx#headerfromvalue) \|[HeaderFromEnv](/graphql/core/api-reference/syntax-defs.mdx#headerfromenv) \] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConfST](/graphql/core/api-reference/syntax-defs.mdx#retryconfst) | Retry configuration if scheduled invocation delivery fails |
| headers | false | \[[HeaderFromValue](/api-reference/syntax-defs.mdx#headerfromvalue) \|[HeaderFromEnv](/api-reference/syntax-defs.mdx#headerfromenv) \] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConfST](/api-reference/syntax-defs.mdx#retryconfst) | Retry configuration if scheduled invocation delivery fails |
| include_in_metadata | true | Boolean | Flag to indicate whether a trigger should be included in the metadata. When a cron trigger is included in the metadata, the user will be able to export it when the metadata of the graphql-engine is exported. |
| comment | false | Text | Custom comment. |
| replace | false | Bool | When replace is set to `true`, the cron trigger will be updated(if exists) and when it's `false` or the field is omitted, then a new cron trigger will be created. |
@ -95,7 +95,7 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|------|----------|------------------------------------------------------------------------|--------------------------|
| name | true | [TriggerName](/graphql/core/api-reference/syntax-defs.mdx#triggername) | Name of the cron trigger |
| name | true | [TriggerName](/api-reference/syntax-defs.mdx#triggername) | Name of the cron trigger |
:::tip Supported from
@ -134,11 +134,11 @@ X-Hasura-Role: admin
| Key | Required | Schema | Description |
|-------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------|
| webhook | true | [WebhookURL](/graphql/core/api-reference/syntax-defs.mdx#webhookurl) | URL of the webhook |
| webhook | true | [WebhookURL](/api-reference/syntax-defs.mdx#webhookurl) | URL of the webhook |
| schedule_at | true | Timestamp (ISO8601 format) | The time at which the invocation should be invoked. |
| payload | false | JSON | Any JSON payload which will be sent when the webhook is invoked. |
| headers | false | \[[HeaderFromValue](/graphql/core/api-reference/syntax-defs.mdx#headerfromvalue) \|[HeaderFromEnv](/graphql/core/api-reference/syntax-defs.mdx#headerfromenv) \] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConfST](/graphql/core/api-reference/syntax-defs.mdx#retryconfst) | Retry configuration if scheduled event delivery fails |
| headers | false | \[[HeaderFromValue](/api-reference/syntax-defs.mdx#headerfromvalue) \|[HeaderFromEnv](/api-reference/syntax-defs.mdx#headerfromenv) \] | List of headers to be sent with the webhook |
| retry_conf | false | [RetryConfST](/api-reference/syntax-defs.mdx#retryconfst) | Retry configuration if scheduled event delivery fails |
| comment | false | Text | Custom comment. |
:::tip Supported from

View File

@ -3,24 +3,22 @@ sidebar_label: Tables/Views
sidebar_position: 2
description: Manage tables and views with the Hasura schema/metadata API
keywords:
- hasura
- docs
- schema/metadata API
- API reference
- table
- view
- hasura
- docs
- schema/metadata API
- API reference
- table
- view
---
# Schema/Metadata API Reference: Tables/Views (Deprecated)
:::caution Deprecation
In versions `v2.0.0` and above, the schema/metadata API is deprecated in
favour of the [schema API](/graphql/core/api-reference/schema-api/index.mdx) and the
[metadata API](/graphql/core/api-reference/metadata-api/index.mdx).
In versions `v2.0.0` and above, the schema/metadata API is deprecated in favour of the
[schema API](/api-reference/schema-api/index.mdx) and the [metadata API](/api-reference/metadata-api/index.mdx).
Though for backwards compatibility, the schema/metadata APIs will
continue to function.
Though for backwards compatibility, the schema/metadata APIs will continue to function.
:::
@ -28,8 +26,7 @@ continue to function.
Track/untrack a table/view in Hasura GraphQL engine.
Only tracked tables/views are available for
querying/mutating/subscribing data over the GraphQL API.
Only tracked tables/views are available for querying/mutating/subscribing data over the GraphQL API.
## track_table {#schema-metadata-track-table}
@ -53,15 +50,15 @@ X-Hasura-Role: admin
### Args syntax {#schema-metadata-track-table-syntax}
| Key | Required | Schema | Description |
|---------|----------|--------------------------------------------------------------------|----------------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| is_enum | false | Boolean | When set to `true`, creates the table as an [enum table](/graphql/core/databases/postgres/schema/enums.mdx#pg-create-enum-table). |
| Key | Required | Schema | Description |
| ------- | -------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| is_enum | false | Boolean | When set to `true`, creates the table as an [enum table](/schema/postgres/enums.mdx#pg-create-enum-table). |
## set_table_is_enum {#schema-metadata-set-table-is-enum}
`set_table_is_enum` sets whether an already-tracked table should be used
as an [enum table](/graphql/core/databases/postgres/schema/enums.mdx#pg-create-enum-table).
`set_table_is_enum` sets whether an already-tracked table should be used as an
[enum table](/schema/postgres/enums.mdx#pg-create-enum-table).
Use table `user_role` as an enum table:
@ -84,15 +81,15 @@ X-Hasura-Role: admin
### Args syntax {#schema-metadata-set-table-is-enum-syntax}
| Key | Required | Schema | Description |
|---------|----------|--------------------------------------------------------------------|--------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| is_enum | true | Boolean | Whether or not the table should be used as an `enum table <enum table>`. |
| Key | Required | Schema | Description |
| ------- | -------- | ----------------------------------------------------- | ------------------------------------------------------------------------ |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| is_enum | true | Boolean | Whether or not the table should be used as an `enum table <enum table>`. |
## track_table v2 {#schema-metadata-track-table-v2}
Version 2 of `track_table` is used to add a table/view to the GraphQL
schema with configuration. You can customise the root field names.
Version 2 of `track_table` is used to add a table/view to the GraphQL schema with configuration. You can customise the
root field names.
Add a table/view `author`:
@ -126,10 +123,9 @@ X-Hasura-Role: admin
}
```
A table can be tracked with a `custom name`. This can be useful when a
table name is not GraphQL compliant, like `Users Address`. A
`custom name` like `users_address` will complement the `"Users Address"`
table, so that it can be added to the GraphQL schema.
A table can be tracked with a `custom name`. This can be useful when a table name is not GraphQL compliant, like
`Users Address`. A `custom name` like `users_address` will complement the `"Users Address"` table, so that it can be
added to the GraphQL schema.
```http
POST /v1/query HTTP/1.1
@ -148,44 +144,40 @@ X-Hasura-Role: admin
}
```
The GraphQL nodes and typenames that are generated will be according to
the `identifier`. For example, in this case, the nodes generated will
be:
The GraphQL nodes and typenames that are generated will be according to the `identifier`. For example, in this case, the
nodes generated will be:
- `users_address`
- `users_address_one`
- `users_address_aggregate`
- `insert_users_address`
- `insert_users_address_one`
- `update_users_address`
- `update_users_address_by_pk`
- `delete_users_address`
- `delete_users_address_by_pk`
- `users_address`
- `users_address_one`
- `users_address_aggregate`
- `insert_users_address`
- `insert_users_address_one`
- `update_users_address`
- `update_users_address_by_pk`
- `delete_users_address`
- `delete_users_address_by_pk`
:::info Note
GraphQL engine requires the constraint names (if any) of a table to be
[GraphQL compliant](https://spec.graphql.org/June2018/#sec-Names) in
order to be able to track it.
[GraphQL compliant](https://spec.graphql.org/June2018/#sec-Names) in order to be able to track it.
:::
### Args syntax {#schema-metadata-track-table-syntax-v2}
| Key | Required | Schema | Description |
|---------------|----------|-------------------------------|----------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [Table Config](/graphql/core/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| Key | Required | Schema | Description |
| ------------- | -------- | ----------------------------------------------------------- | -------------------------------- |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [Table Config](/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
## set_table_custom_fields (deprecated) {#schema-metadata-set-table-custom-fields}
`set_table_custom_fields` has been deprecated. Use the
[set_table_customization](#schema-metadata-set-table-customization) API
to set the custom table fields.
[set_table_customization](#schema-metadata-set-table-customization) API to set the custom table fields.
`set_table_custom_fields` in version `2` sets the custom root fields and
custom column names of already tracked table. This will **replace** the
already present custom fields configuration.
`set_table_custom_fields` in version `2` sets the custom root fields and custom column names of already tracked table.
This will **replace** the already present custom fields configuration.
Set custom fields for table/view `author`:
@ -219,20 +211,18 @@ X-Hasura-Role: admin
### Args syntax {#schema-metadata-set-table-custom-fields-syntax}
| Key | Required | Schema | Description |
|---------------------|----------|--------------------------------------------------------------------------------------|-----------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| custom_root_fields | false | [Custom Root Fields](/graphql/core/api-reference/syntax-defs.mdx#custom-root-fields) | Customise the root fields |
| custom_column_names | false | [CustomColumnNames](/graphql/core/api-reference/syntax-defs.mdx#customcolumnnames) | Customise the column fields |
| Key | Required | Schema | Description |
| ------------------- | -------- | ----------------------------------------------------------------------- | --------------------------- |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| custom_root_fields | false | [Custom Root Fields](/api-reference/syntax-defs.mdx#custom-root-fields) | Customise the root fields |
| custom_column_names | false | [CustomColumnNames](/api-reference/syntax-defs.mdx#customcolumnnames) | Customise the column fields |
## set_table_customization {#schema-metadata-set-table-customization}
`set_table_customization` allows you to customize any given table with a
custom name, custom root fields and custom column names of an already
tracked table. This will **replace** the already present customization.
`set_table_customization` allows you to customize any given table with a custom name, custom root fields and custom
column names of an already tracked table. This will **replace** the already present customization.
[set_table_custom_fields](#schema-metadata-set-table-custom-fields) has
been deprecated in favour of this API.
[set_table_custom_fields](#schema-metadata-set-table-custom-fields) has been deprecated in favour of this API.
Set the configuration for a table/view called `author`:
@ -268,10 +258,10 @@ X-Hasura-Role: admin
### Args syntax {#schema-metadata-set-table-customization-syntax}
| Key | Required | Schema | Description |
|---------------|----------|-------------------------------------------------------------------------|----------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [TableConfig](/graphql/core/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
| Key | Required | Schema | Description |
| ------------- | -------- | ---------------------------------------------------------- | -------------------------------- |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| configuration | false | [TableConfig](/api-reference/syntax-defs.mdx#table-config) | Configuration for the table/view |
## untrack_table {#schema-metadata-untrack-table}
@ -298,7 +288,7 @@ X-Hasura-Role: admin
### Args syntax {#schema-metadata-untrack-table-syntax}
| Key | Required | Schema | Description |
|---------|----------|--------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|
| table | true | [TableName](/graphql/core/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| cascade | false | Boolean | When set to `true`, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions, templates) |
| Key | Required | Schema | Description |
| ------- | -------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| table | true | [TableName](/api-reference/syntax-defs.mdx#tablename) | Name of the table |
| cascade | false | Boolean | When set to `true`, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions, templates) |

View File

@ -263,7 +263,6 @@ String
| select | false | `String` \| [CustomRootField](#customrootfield) | Customise the `<table-name>` root field. Using a `String` customises the field name. |
| select_by_pk | false | `String` \| [CustomRootField](#customrootfield) | Customise the `<table-name>_by_pk` root field. Using a `String` customises the field name. |
| select_aggregate | false | `String` \| [CustomRootField](#customrootfield) | Customise the `<table-name>_aggregate` root field. Using a `String` customises the field name. |
| select_stream | false | `String` \| [CustomRootField](#customrootfield) | Customise the `<table-name>_stream` root field. Using a `String` customises the field name. |
| insert | false | `String` \| [CustomRootField](#customrootfield) | Customise the `insert_<table-name>` root field. Using a `String` customises the field name. |
| insert_one | false | `String` \| [CustomRootField](#customrootfield) | Customise the `insert_<table-name>_one` root field. Using a `String` customises the field name. |
| update | false | `String` \| [CustomRootField](#customrootfield) | Customise the `update_<table-name>` root field. Using a `String` customises the field name. |
@ -1173,7 +1172,7 @@ spec](https://spec.graphql.org/June2018/#Name).
:::info Note
The `GraphQL Types` used in creating an action must be defined before
via [Custom Types](/graphql/core/api-reference/metadata-api/custom-types.mdx)
via [Custom Types](/api-reference/metadata-api/custom-types.mdx)
:::
@ -1417,7 +1416,7 @@ HGE provides the following functions that can be used in the template:
|---------------|----------|---------------------|--------------------------------------------------------------------------------------------------------|
| action | true | remove \| transform \| x_www_form_urlencoded | The action to perform on the request body. |
| template | false | String | The transformation template to be applied to the body. This is required if the action is *transform*. |
| form_template | false | Object ([String](/graphql/core/databases/postgres/postgresql-types.mdx#string) : [String](/graphql/core/databases/postgres/postgresql-types.mdx#string)) | The key/value pairs to be used in a `x-www-url-formencoded` body. The values can be transfomation templates. |
| form_template | false | Object ([String](/databases/postgres/postgresql-types.mdx#string) : [String](/databases/postgres/postgresql-types.mdx#string)) | The key/value pairs to be used in a `x-www-url-formencoded` body. The values can be transfomation templates. |
## TemplateEngine {#templateengine}
@ -1481,9 +1480,9 @@ Note: _One_ of and _only one_ of `to_source` and `to_remote_schema` must be pres
| Key | Required | Schema | Description |
|---------------|----------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| remote_schema | true | [RemoteSchemaName](/graphql/core/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema to join with |
| lhs_fields | true | [[PGColumn](/graphql/core/api-reference/syntax-defs.mdx#pgcolumn) \| [ComputedFieldName](/graphql/core/api-reference/syntax-defs.mdx#computedfieldname)] | Column/Computed field(s) in the table that is used for joining with remote schema field. All join keys in `remote_field` must appear here. |
| remote_field | true | [RemoteField](/graphql/core/api-reference/syntax-defs.mdx#remotefield) | The schema tree ending at the field in remote schema which needs to be joined with. |
| remote_schema | true | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the remote schema to join with |
| lhs_fields | true | [[PGColumn](/api-reference/syntax-defs.mdx#pgcolumn) \| [ComputedFieldName](/api-reference/syntax-defs.mdx#computedfieldname)] | Column/Computed field(s) in the table that is used for joining with remote schema field. All join keys in `remote_field` must appear here. |
| remote_field | true | [RemoteField](/api-reference/syntax-defs.mdx#remotefield) | The schema tree ending at the field in remote schema which needs to be joined with. |
## RemoteField {#remotefield}
```

View File

@ -1,4 +1,4 @@
{
"label": "Authentication & Authorization",
"position": 7
"position": 70
}

View File

@ -62,9 +62,9 @@ Here's how a GraphQL query is processed in JWT mode:
**See more details at:**
- [Using webhooks](/graphql/core/auth/authentication/webhook.mdx)
- [Using JWT](/graphql/core/auth/authentication/jwt.mdx)
- [Unauthenticated / Public access](/graphql/core/auth/authentication/unauthenticated-access.mdx)
- [Using webhooks](/auth/authentication/webhook.mdx)
- [Using JWT](/auth/authentication/jwt.mdx)
- [Unauthenticated / Public access](/auth/authentication/unauthenticated-access.mdx)
:::info Additional Resources

View File

@ -32,8 +32,8 @@ system.
:::info Prerequisite
It is mandatory to first [secure your GraphQL endpoint](/graphql/core/deployment/securing-graphql-endpoint.mdx) for the
JWT mode to take effect.
It is mandatory to first [secure your GraphQL endpoint](/deployment/securing-graphql-endpoint.mdx) for the JWT mode to
take effect.
:::
@ -206,7 +206,7 @@ Following is the behaviour in detail:
#### Example JWK URL
- Auth0 publishes their JWK url at: `https://<YOUR_AUTH0_DOMAIN>.auth0.com`. But Auth0 has a bug. See known issues:
[Auth0](/graphql/core/auth/authentication/jwt.mdx#auth0-issues).
[Auth0](/auth/authentication/jwt.mdx#auth0-issues).
- Firebase publishes their JWK url at:
`https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com`.
@ -396,6 +396,13 @@ in a JSON object with `path` as the key and the JSON path as the value:
}
```
:::info Note
If `claims_map` is provided in the JWT config, `claims_namespace`/`claims_namespace_path` and `claims_format` will be
ignored.
:::
**Example: JWT config with JSON path values**
```json
@ -660,8 +667,7 @@ If you are using Firebase and Hasura, use this config:
### Auth0 {#auth0-issues}
Refer to the [Auth0 JWT Integration guide](/graphql/core/guides/integrations/auth0-jwt.mdx) for a full integration guide
with Auth0.
Refer to the [Auth0 JWT Integration guide](/guides/integrations/auth0-jwt.mdx) for a full integration guide with Auth0.
Auth0 publishes their JWK under:
@ -709,8 +715,8 @@ Clerk integrates with Hasura GraphQL Engine using JWTs.
Clerk publishes their JWK under: `https://<YOUR_CLERK_FRONTEND_API>/.well-known/jwks.json`
Refer to the [Clerk authentication guide](/graphql/core/guides/integrations/clerk-authentication.mdx) to set up
authenticated requests to Hasura with Clerk.
Refer to the [Clerk authentication guide](/guides/integrations/clerk-authentication.mdx) to set up authenticated
requests to Hasura with Clerk.
## Generating JWT Config {#generating-jwt-config}
@ -729,8 +735,8 @@ escaping new lines.
Here are some sample apps that use JWT authorization. You can follow the instructions in the READMEs of the repositories
to get started.
- [Custom JWT server with Hasura actions](/graphql/core/actions/codegen/python-flask.mdx): A simple Python / Flask API
that implements `Signup` and `Login` methods as actions returning JWTs
- [Custom JWT server with Hasura actions](/actions/codegen/python-flask.mdx): A simple Python / Flask API that
implements `Signup` and `Login` methods as actions returning JWTs
- [Auth0 JWT example](https://github.com/hasura/graphql-engine/tree/master/community/sample-apps/todo-auth0-jwt): A todo
app that uses Hasura GraphQL engine and Auth0 JWT
- [Firebase JWT example](https://github.com/hasura/graphql-engine/tree/master/community/sample-apps/firebase-jwt):

View File

@ -18,7 +18,7 @@ It is a common requirement to have requests which are accessible to all
users without the need for any authentication (logging in). For example,
to display a public feed of events.
Once you have configured an [admin secret](/graphql/core/deployment/securing-graphql-endpoint.mdx),
Once you have configured an [admin secret](/deployment/securing-graphql-endpoint.mdx),
by default Hasura GraphQL engine will reject any unauthenticated request
it receives.
@ -29,14 +29,14 @@ configured, unauthenticated requests will not be rejected and instead
the request will be made with the configured role.
This role can then be used to define the permissions for unauthenticated
users as described in [Authorization / Access control](/graphql/core/auth/authorization/index.mdx). A guide on setting up
users as described in [Authorization / Access control](/auth/authorization/index.mdx). A guide on setting up
unauthenticated user permissions can be found
[here](/graphql/core/auth/authorization/common-roles-auth-examples.mdx#anonymous-users-example).
[here](/auth/authorization/common-roles-auth-examples.mdx#anonymous-users-example).
:::caution Risk of using session variables
It is recommended to not use
[session variables](/graphql/core/auth/authorization/roles-variables.mdx#dynamic-session-variables) in the permissions of an
[session variables](/auth/authorization/roles-variables.mdx#dynamic-session-variables) in the permissions of an
unauthenticated role because the source of the session variables cannot
be trusted. As session variables can be passed using request headers, a
user can choose to send any values for them and it needs to be ensured
@ -57,28 +57,28 @@ request.
You can use the env variable `HASURA_GRAPHQL_UNAUTHORIZED_ROLE` or the
`--unauthorized-role` flag to set a role for unauthenticated (non-logged
in) users. See [GraphQL Engine server config reference](/graphql/core/deployment/graphql-engine-flags/reference.mdx) for more details on setting this
in) users. See [GraphQL Engine server config reference](/deployment/graphql-engine-flags/reference.mdx) for more details on setting this
flag/env var.
### Webhooks
For [webhook authentication](/graphql/core/auth/authentication/webhook.mdx), any request for which the
For [webhook authentication](/auth/authentication/webhook.mdx), any request for which the
webhook returns a `401 Unauthorized` response is considered an
unauthenticated request.
To allow unauthenticated access, the auth webhook should return a `200`
status response with your unauthenticated role in the headers. For
details on the webhook response, refer to
[this section](/graphql/core/auth/authentication/webhook.mdx#webhook-response).
[this section](/auth/authentication/webhook.mdx#webhook-response).
### JWT
For [JWT authentication](/graphql/core/auth/authentication/jwt.mdx), any request which does not contain
For [JWT authentication](/auth/authentication/jwt.mdx), any request which does not contain
a JWT token is considered an unauthenticated request.
You can use the env variable `HASURA_GRAPHQL_UNAUTHORIZED_ROLE` or the
`--unauthorized-role` flag to set a role for unauthenticated (non-logged
in) users. See [GraphQL Engine server config reference](/graphql/core/deployment/graphql-engine-flags/reference.mdx) for more details on setting this
in) users. See [GraphQL Engine server config reference](/deployment/graphql-engine-flags/reference.mdx) for more details on setting this
flag/env var.
:::info Additional Resources

View File

@ -23,7 +23,7 @@ server.
:::info Prerequisite
It is mandatory to first [secure your GraphQL endpoint](/graphql/core/deployment/securing-graphql-endpoint.mdx) for the
It is mandatory to first [secure your GraphQL endpoint](/deployment/securing-graphql-endpoint.mdx) for the
webhook mode to take effect.
:::
@ -38,17 +38,17 @@ In webhook mode, on a secured endpoint:
- You can configure Hasura to run in webhook mode by running the GraphQL engine with the `--auth-hook` flag or the
`HASURA_GRAPHQL_AUTH_HOOK` environment variable (see
[GraphQL engine server options](/graphql/core/deployment/graphql-engine-flags/reference.mdx)), the value of which is
[GraphQL engine server options](/deployment/graphql-engine-flags/reference.mdx)), the value of which is
the webhook endpoint.
- You can configure Hasura to send either a `GET` or a `POST` request to your auth webhook. The default configuration is
`GET` and you can override this with `POST` by using the `--auth-hook-mode` flag or the
`HASURA_GRAPHQL_AUTH_HOOK_MODE` environment variable (_in addition to those specified above;
see_ [GraphQL engine server options](/graphql/core/deployment/graphql-engine-flags/reference.mdx)).
see_ [GraphQL engine server options](/deployment/graphql-engine-flags/reference.mdx)).
:::info Note
If you are running Hasura using Docker, ensure that the Hasura Docker container can reach the webhook. See
[this page](/graphql/core/guides/docker-networking.mdx) for Docker networking.
[this page](/guides/docker-networking.mdx) for Docker networking.
:::

View File

@ -0,0 +1,194 @@
---
description: Hasura access control basics
keywords:
- hasura
- docs
- authorization
- access control
sidebar_position: 2
---
import Thumbnail from '@site/src/components/Thumbnail';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Access control basics
## Introduction
To understand the basics of access control in Hasura, let's take a look at this analogy to a SQL query:
<Thumbnail
src='/img/graphql/core/auth/permissions-rule-analogy.png'
alt='Understanding access control in Hasura'
width='700px'
/>
This query returns the right set of results by defining the requirements for columns and rows in a given table. Hasura's
rule-based access control works similarly - you define the following permissions for a combination of **role**,
**table**, and **action** (_insert, update, select and delete_):
**Row-level permissions**
Limit access to a subset of the rows in the table based on this permission. Row-level permissions are essentially
boolean expressions that; when evaluated against any row determine access to it. These permissions are constructed from
the values in columns, [session variables](/auth/authorization/roles-variables.mdx) and static values to build this
boolean expression.
**Column-level permissions**
For the rows that are accessible based on the above, limit access to a subset of the columns based on this permission
rule.
:::info More information
For details on all the configuration options, see
[Configuring permission rules](/auth/authorization/permission-rules.mdx).
:::
## Example
Let's see access control in action using a simple example.
### Create a table
Head to your console and [create a table](/schema/postgres/tables.mdx#pg-create-tables) called `authors` with the
following schema:
```sql
authors (
id INT PRIMARY KEY,
name TEXT
)
```
Now, insert some sample data into the table using the `Insert Row` tab of the `authors` table.
### Run a query **without** access control
Head to the `API` tab in your console and try out the below query:
```graphql
query {
authors {
id
name
}
}
```
The response of the above query contains all the authors as, by default, the GraphQL query runs with **admin**
permissions.
<Thumbnail src='/img/graphql/core/auth/fetch-authors.png' alt='Run a query without access control' width='1200px' />
### Define access control rules
Now let's define an access control rule for the `authors` table for a role `user`.
<Tabs className="api-tabs">
<TabItem value="console" label="Console">
Head to the **Permissions** section of the table (`Data -> [table] -> Permissions` tab) and define permissions as shown
below:
<Thumbnail
src='/img/graphql/core/auth/permission-basics-simple-example.png'
alt='Define access control rules'
width='1100px'
/>
</TabItem>
<TabItem value="cli" label="CLI">
You can add permissions in the `tables.yaml` file inside the `metadata` directory:
```yaml {4-12}
- table:
schema: public
name: authors
select_permissions:
- role: user
permission:
columns:
- id
- name
filter:
id:
_eq: X-Hasura-User-Id
```
Apply the metadata by running:
```bash
hasura metadata apply
```
</TabItem>
<TabItem value="api" label="API">
You can add select permissions by using the
[pg_create_select_permission metadata API](/api-reference/metadata-api/permission.mdx#metadata-pg-create-select-permission):
```http
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type" : "pg_create_select_permission",
"args" : {
"source": "<db_name>",
"table" : "authors",
"role" : "user",
"permission" : {
"columns" : [
"id",
"name"
],
"filter" : {
"id" : "X-Hasura-User-Id"
}
}
}
}
```
</TabItem>
</Tabs>
This permission rule reads as: "_For the role_ `user` _, table_ `authors` _and operation_ `select`/`query`, allow access
to those rows where the value in the `id` _column is the same as the value in the_ `X-Hasura-User-ID` _session
variable_".
### Run a query **with** access control
Let's run the same query as above but now with the `X-Hasura-Role` and `X-Hasura-User-ID` session variables also
included to indicate role and user information. These session variables are passed in the `Request Headers` section of
`GraphiQL` as highlighted below:
<Thumbnail
src='/img/graphql/core/auth/permission-basics-query-with-access-control.png'
alt='Run a query with access control'
width='1200px'
/>
As you can see, the results are now filtered based on the access control rule for the role `user` (_since that is the
role indicated by the_ `X-Hasura-Role` _session variable_) and the results are restricted to only those rows where the
value in the `id` column is equal to `3` (_as indicated by the_ `X-Hasura-User-ID` _session variable_).
As described in the [Introduction to Authentication and Authorization](/auth/authorization/index.mdx) section of the
docs, your auth service is required to resolve authentication tokens into these session variables.
## Next steps
Read about roles and session variables at: [Roles & Session variables](/auth/authorization/roles-variables.mdx) See more
detailed examples at: [Common access control examples](/auth/authorization/common-roles-auth-examples.mdx)
:::info Additional Resources
Enterprise Grade Authorization -
[Watch Webinar](https://hasura.io/events/webinar/authorization-modeling-hasura/?pg=docs&plcmt=body&cta=watch-webinar&tech=).
:::

View File

@ -0,0 +1,397 @@
---
description: Examples for managing access control with Hasura
keywords:
- hasura
- docs
- authorization
- access control
- examples
sidebar_position: 6
---
import Thumbnail from '@site/src/components/Thumbnail';
# Access control examples
## Introduction
This is a guide to help you set up a basic authorization architecture for your GraphQL fields. It is recommended that
you first check out [Roles & Session variables](/auth/authorization/roles-variables.mdx) and
[Configuring permission rules](/auth/authorization/permission-rules.mdx) that will be referred to throughout this guide.
Here are some examples of common use cases.
## Anonymous (not logged in) users {#anonymous-users-example}
- Create a role called `anonymous` (this value is up to you, you could even name the role `public`).
- Generally, you wouldn't add insert, update, or delete permissions.
- For the select permission condition, create a valid condition depending on your data model. For example,
`is_published: {_eq: true}`.
- If you don't have a condition, then just set the permission to `Without any checks`, represented by a `{}`.
- Choose the right set of columns that will get exposed in the GraphQL schema as fields. Ensure that sensitive
information will not be exposed.
<Thumbnail
src='/img/graphql/core/auth/anonymous-role-examples.png'
alt='Access control for an anonymous role'
width='1300px'
className='no-shadow'
/>
See [Unauthenticated / Public access](/auth/authentication/unauthenticated-access.mdx) for steps to configure the
anonymous user role in Hasura.
## Logged-in users
- Create a role called `user`.
- Access control rules in this case are usually dependent on a `user_id` or a `owner_id` column in your data model.
- Set up a permission for insert/select/update/delete that uses said column. E.g.:
`author_id: {_eq: "X-Hasura-User-Id"}` for an article table.
- Note that the `X-Hasura-User-Id` is a [dynamic session variable](/auth/authorization/roles-variables.mdx) that comes
in from your [auth webhook's](/auth/authentication/webhook.mdx) response, or as a request header if you're testing.
<Thumbnail
src='/img/graphql/core/auth/user-select-graphiql.png'
alt='Access control for a logged-in user'
width='1300px'
className='no-shadow'
/>
## Managers of an organisation in a multi-tenant app
Suppose you have a multi-tenant application where managers of a particular organisation can see all of the data that
belongs to the organisation. In this case, your data models will probably have an `org_id` column that denotes the
organisation either in the same table or via a related table.
- Create a role called `manager`.
- Create a permission for select, which has the condition: `org_id: {_eq: "X-Hasura-Org-Id"}`.
- `X-Hasura-Org-Id` is a [dynamic variable](/auth/authorization/roles-variables.mdx) that is returned by your
[auth webhook](/auth/authentication/webhook.mdx) for an incoming GraphQL request.
<Thumbnail
src='/img/graphql/core/auth/org-manager-graphiql.png'
alt='Access control for a manager of an organisation'
width='1300px'
className='no-shadow'
/>
## Collaborators of an article
Let's say the "ownership" or "visibility" information for a data model (table) is not present as a column in the table,
but in a different related table. In this case, let's say there is an `article` table and a `collaborator` table that
has `article_id, collaborator_id` columns.
- Create a relationship called `collaborators` from the article table.
- Array relationship (article has array of collaborators): `article :: id → collaborator :: article_id`.
- Create a role called `collaborator`.
- Create a select permission on the `article` table, which has the condition:
`collaborators: {collaborator_id: {_eq: "X-Hasura-User_id"}}`.
- This reads as: Allow the role collaborator to select if `article.collaborators` has a `collaborator_id` equal to
that of `X-Hasura-User-Id`.
<Thumbnail
src='/img/graphql/core/auth/collaborator-relationship.png'
alt='Access control for collaborators of an article'
width='1300px'
className='no-shadow'
/>
<!--
.. Role-based schemas
------------------
For every role that you create, Hasura automatically publishes a different GraphQL schema that represents the
right queries, fields, and mutations that are available to that role.
Case 1: Logged-in users and anonymous users can access the same GraphQL fields
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In simple use-cases, logged-in users and anonymous users might be able to fetch different rows (let's say because
of a ``is_public`` flag), but have access to the same fields.
- ``anonymous`` role has a ``{is_public: {_eq: true}}`` select condition.
- This reads: Allow anyone to access rows that are marked public.
- ``user`` role has a ``_or: [{is_public: {_eq: true}}, {owner_id: {_eq: "X-Hasura-User-Id"}}]``.
- This reads: Allow users to access any rows that are public, or that are owned by them.
Case 2: Logged-in users and anonymous users have access to different fields
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In this case, anonymous users might have access only to a subset of fields while logged-in users can access all the
fields for data that they own.
- ``anonymous`` role has a ``{is_public: {_eq: true}}`` select condition, and only the right columns are allowed to
be selected.
- This reads: Allow anyone to access rows that are marked public.
- ``user`` role has a ``{owner_id: {_eq: "X-Hasura-User-Id"}}`` and all the columns are marked as selected.
- This reads: Allow users to that are owned by them.
-->
## Multiple roles per user {#nested-object-permissions-example}
Sometimes your data/user model requires that:
- Users can have multiple roles.
- Each role has access to different parts of your database schema.
If you have the information about roles and how they map to your data in the same database as the one configured with
the GraphQL engine, you can leverage relationships to define permissions that effectively control access to data and the
operations each role is allowed to perform.
To understand how this works, let's model the roles and corresponding permissions in the context of a blog app with the
following roles:
- `author`: Users with this role can submit **their own** articles.
- `reviewer`: Users with this role can review **articles assigned to them** and add a review comment to each article. A
mapping of articles to reviewers is maintained in the `reviewers` table.
- `editor`: Users with this role can edit and publish **any article**. They can also leave a private rating for each
article. However, they cannot overwrite a reviewer's notes. A list of editors is maintained in the `editors` table.
### Database Schema
The following is a reference database schema for our example:
<Thumbnail
src='/img/graphql/core/auth/multirole-example-db-schema.png'
alt='Database schema example for multiple roles per user'
width='1300px'
/>
Based on the above schema, we'll create the following tables:
```sql
-- user information from your auth system
users (
id INT PRIMARY KEY,
name TEXT,
profile JSONB, -- some profile information like display_name, etc.
registered_at TIMESTAMP -- the time when this user registered
)
-- information about articles
articles (
id INTEGER PRIMARY KEY,
title TEXT,
author_id INT REFERENCES users(id), -- Foreign key to users :: id
is_reviewed BOOLEAN DEFAULT FALSE,
review_comment TEXT,
is_published BOOLEAN DEFAULT FALSE,
editor_rating INTEGER
)
-- mapping of reviewers to articles
reviewers (
id INTEGER PRIMARY KEY,
article_id INTEGER REFERENCES articles(id), -- Foreign key to articles :: id
reviewer_id INTEGER REFERENCES users(id) -- Foreign key to users :: id
)
-- a list of editors
editors (
editor_id INTEGER PRIMARY KEY REFERENCES users(id) -- Foreign key to users :: id
)
```
### Relationships
Create an array relationship named `reviewers` based on the foreign key constraint `reviewers` :: `article_id` →
`articles` :: `id`:
<Thumbnail
src='/img/graphql/core/auth/multirole-example-reviewers-array-relationship.png'
alt='Create an array relationship'
width='700px'
className='no-shadow'
/>
### Permissions
The following is an example summary of the access control requirements for the `articles` table based on the above
schema:
<table>
<thead>
<tr>
<th width='30%' rowspan='2' colspan='1'>
Client Name
</th>
<th width='25%' rowspan='1' colspan='2'>
author
</th>
<th width='25%' rowspan='1' colspan='2'>
reviewer
</th>
<th width='25%' rowspan='1' colspan='2'>
editor
</th>
</tr>
<tr>
<th>insert</th>
<th>select</th>
<th>update</th>
<th>select</th>
<th>update</th>
<th>select</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>✔</td>
<td>✔</td>
<td>✖</td>
<td>✔</td>
<td>✖</td>
<td>✔</td>
</tr>
<tr>
<td>title</td>
<td>✔</td>
<td>✔</td>
<td>✔</td>
<td>✔</td>
<td>✔</td>
<td>✔</td>
</tr>
<tr>
<td>author_id</td>
<td>✔</td>
<td>✔</td>
<td>✖</td>
<td>✔</td>
<td>✖</td>
<td>✔</td>
</tr>
<tr>
<td>is_reviewed</td>
<td>✖</td>
<td>✔</td>
<td>✔</td>
<td>✔</td>
<td>✔</td>
<td>✔</td>
</tr>
<tr>
<td>review_comment</td>
<td>✖</td>
<td>✔</td>
<td>✔</td>
<td>✔</td>
<td>✖</td>
<td>✔</td>
</tr>
<tr>
<td>is_published</td>
<td>✖</td>
<td>✔</td>
<td>✖</td>
<td>✔</td>
<td>✔</td>
<td>✔</td>
</tr>
<tr>
<td>editor_rating</td>
<td>✖</td>
<td>✖</td>
<td>✖</td>
<td>✖</td>
<td>✔</td>
<td>✔</td>
</tr>
</tbody>
</table>
_Additional restriction required to ensure that a user with the role_ `author` _can submit only their own article i.e._
`author_id` _should be the same as the user's id_.
We'll create permission rules for the roles and actions listed above (_you can easily extend them for the actions not
documented here_) .
#### Permissions for role `author`
- **Allow users with the role** `author` **to insert only their own articles**
For this permission rule, we'll make use of two features of the GraphQL engine's permissions system:
- [Column-level permissions](/auth/authorization/permission-rules.mdx#col-level-permissions): Restrict access to
certain columns only.
- [Column presets](/schema/postgres/default-values/column-presets.mdx): Session-variable-based column preset for the
`author_id` column to automatically insert the user's ID i.e. the `X-Hasura-User-Id` session-variable's value. It
also helps us avoid explicitly passing the user's ID in the insert mutation.
<Thumbnail src='/img/graphql/core/auth/multirole-example-author-insert.png' alt='Permissions for the role author' />
Notice how we don't need to have an explicit row-level permission (_a custom check_) as only authenticated users with
the role `author` can perform this action. As we have a column preset for the `author_id` column that automatically
takes the author's ID (_and the_ `id` _column is an auto-increment integer field_), we only need to allow access to the
`title` column.
- **Allow users with the role** `author` **to select certain columns only**
Again, we'll use **column-level** permissions to restrict access to certain columns. Additionally, we need to define
row-level permissions (_a custom check_) to restrict access to only those articles authored by the current user:
<Thumbnail src='/img/graphql/core/auth/multirole-example-author-select.png' alt='Column access for the role author' />
The row-level permission rule shown here translates to "_if the value in the_ `author_id` _column of this row is equal
to the user's ID i.e. the\* `X-Hasura-User-Id` \_session-variable's value, allow access to it_".
#### Permissions for role `reviewer`
- **Allow users with the role** `reviewer` **to update articles assigned to them for reviews**
For this use-case, we'll use
[relationship or nested-object permissions](/auth/authorization/permission-rules.mdx#relationships-in-permissions)
based on the array relationship `reviewers` to restrict access to assigned articles only.
<Thumbnail src='/img/graphql/core/auth/multirole-example-reviewer-update.png' alt='Permissions for the role reviewer' />
The array-relationship based permission rule in the above image
reads as "_if the ID of any reviewer assigned to this article is
equal to the user's ID i.e. the* `X-Hasura-User-Id`
*session-variable's value, allow access to it_". The columns' access
is restricted using the column-level permissions highlighted above.
- **Allow users with the role** `reviewer` **to select articles assigned to them for reviews**
This permission rule is pretty much the same as the one for update, the only difference being the column-level
permissions.
<Thumbnail
src='/img/graphql/core/auth/multirole-example-reviewer-select.png'
alt='Column access for the role reviewer'
/>
#### Permissions for role `editor`
- **Allow editors to select any article's data**
This is a straightforward rule - there's no need for any row-level permissions since editors have access to all rows
and they can _read_ all columns.
<Thumbnail src='/img/graphql/core/auth/multirole-example-editor-select.png' alt='Permissions for the role editor' />
- **Allow editors to update an article**
There's no need for row-level permissions in this case either but we need to restrict access to certain columns only:
<Thumbnail src='/img/graphql/core/auth/multirole-example-editor-update.png' alt='Column access for the role editor' />
:::info Additional Resources
Enterprise Grade Authorization -
[Watch Webinar](https://hasura.io/events/webinar/authorization-modeling-hasura/?pg=docs&plcmt=body&cta=watch-webinar&tech=).
:::

View File

@ -11,14 +11,13 @@ keywords:
- access control
---
# Disabling root fields
## Introduction
When you track a table in Hasura, by default it exposes all the root fields available to the role. However,
sometimes you may want a role to only have access to certain root fields of a table or have the table be accessible
only through [relationships](/graphql/core/databases/postgres/schema/table-relationships/index.mdx).
When you track a table in Hasura, by default it exposes all the root fields available to the role. However, sometimes
you may want a role to only have access to certain root fields of a table or have the table be accessible only through
[relationships](/schema/postgres/table-relationships/index.mdx).
:::info Note
@ -38,10 +37,10 @@ Disabling root fields is supported in version `v2.8.0` and above.
Let's say we have two tables, `authors` and `articles` defined as follows:
| Table | Columns | Hasura relationships |
|----------|-------------------------------------------------------------------------------|----------------------|
| author | `id`, `first_name`, `last_name`, `created_at`, `is_active` | articles (array) |
| articles | `id`, `author_id`, `title`, `content`, `created_at`, `is_public` | author (object) |
| Table | Columns | Hasura relationships |
| -------- | ---------------------------------------------------------------- | -------------------- |
| author | `id`, `first_name`, `last_name`, `created_at`, `is_active` | articles (array) |
| articles | `id`, `author_id`, `title`, `content`, `created_at`, `is_public` | author (object) |
We would like to configure permissions of the `guest` role such that they are only able to access the `articles` of the
`authors` which they can access i.e. access the `articles` table only through the `authors` -> `articles` relationship.
@ -71,22 +70,19 @@ X-Hasura-Role: admin
}
```
With this the `guest` role is allowed to select all columns and rows
where `is_public` is set to `true` in the `articles` table. Note that
`query_root_fields` and `subscription_root_fields` are set to `[]`,
which means that the `guest` role won't be able to access the `articles`
table directly, but will be able to access it through the `articles` relationship.
With this the `guest` role is allowed to select all columns and rows where `is_public` is set to `true` in the
`articles` table. Note that `query_root_fields` and `subscription_root_fields` are set to `[]`, which means that the
`guest` role won't be able to access the `articles` table directly, but will be able to access it through the `articles`
relationship.
:::caution
If root fields are disabled then you may try to simplify the row filter permissions
by giving it "all rows" but you should be cautious here because the field may be
accessible through a different type e.g. `returning` field in a mutation output type.
If root fields are disabled then you may try to simplify the row filter permissions by giving it "all rows" but you
should be cautious here because the field may be accessible through a different type e.g. `returning` field in a
mutation output type.
:::
### 2. Access only via primary key
Let's say you want to allow a client to fetch data from a table only if the client knows the primary key of a row in
@ -117,7 +113,6 @@ X-Hasura-Role: admin
}
```
### 3. Disable subscription fields
You can allow a role to only be able to make query and not subscription requests.

View File

@ -15,9 +15,9 @@ import Thumbnail from "@site/src/components/Thumbnail";
## Overview
Hasura supports **role-based** authorization where access control is done by creating rules for each role and operation. In the case of database tables, you can create rules for database operations (select, insert, update, delete) and in the case of [remote schemas](/graphql/core/remote-schemas/index.mdx), you can define rules for access to fields. These access control rules use dynamic session
Hasura supports **role-based** authorization where access control is done by creating rules for each role and operation. In the case of database tables, you can create rules for database operations (select, insert, update, delete) and in the case of [remote schemas](/remote-schemas/index.mdx), you can define rules for access to fields. These access control rules use dynamic session
variables that are passed to the GraphQL engine from your
[authentication service](/graphql/core/auth/authentication/index.mdx) with every request. Role information is inferred from the `X-Hasura-Role` and `X-Hasura-Allowed-Roles` session variables. Other session variables can be passed by your auth service as per your requirements.
[authentication service](/auth/authentication/index.mdx) with every request. Role information is inferred from the `X-Hasura-Role` and `X-Hasura-Allowed-Roles` session variables. Other session variables can be passed by your auth service as per your requirements.
**For example:**
@ -47,23 +47,23 @@ just:
for*). The data in the response will be restricted as per your
configuration.
Follow the example at [access control basics](/graphql/core/auth/authorization/basics.mdx).
Follow the example at [access control basics](/auth/authorization/basics.mdx).
**See:**
- [Access control basics](/graphql/core/auth/authorization/basics.mdx)
- [Roles & Session variables](/graphql/core/auth/authorization/roles-variables.mdx)
- [Inherited roles](/graphql/core/auth/authorization/inherited-roles.mdx)
- [Configuring permission rules](/graphql/core/auth/authorization/permission-rules.mdx)
- [Access control examples](/graphql/core/auth/authorization/common-roles-auth-examples.mdx)
- [Multiple column + row permissions for the same role](/graphql/core/auth/authorization/role-multiple-rules.mdx)
- [Disabling root fields](/graphql/core/auth/authorization/disabling-root-fields.mdx)
- [Access control basics](/auth/authorization/basics.mdx)
- [Roles & Session variables](/auth/authorization/roles-variables.mdx)
- [Inherited roles](/auth/authorization/inherited-roles.mdx)
- [Configuring permission rules](/auth/authorization/permission-rules.mdx)
- [Access control examples](/auth/authorization/common-roles-auth-examples.mdx)
- [Multiple column + row permissions for the same role](/auth/authorization/role-multiple-rules.mdx)
- [Disabling root fields](/auth/authorization/disabling-root-fields.mdx)
:::info API limits and access controls in Hasura Cloud
Additional access controls and API limits like maximum query depth can
be found in Hasura Cloud. See more at
[API limits with Hasura Cloud](/graphql/cloud/security/api-limits.mdx).
[API limits with Hasura Cloud](/security/api-limits.mdx).
:::

View File

@ -86,7 +86,7 @@ hasura metadata apply
<TabItem value="api" label="API">
You can add a inherited role using the
[add_inherited_role metadata API](/graphql/core/api-reference/metadata-api/inherited-roles.mdx#metadata-add-inherited-role):
[add_inherited_role metadata API](/api-reference/metadata-api/inherited-roles.mdx#metadata-add-inherited-role):
```http
POST /v1/metadata HTTP/1.1
@ -424,7 +424,7 @@ no way to resolve this conflict.
Whenever a conflict occurs while a role inherits from its parents, then
the metadata for that entity and role combination will be marked as
inconsistent. These can be seen by calling the
[get_inconsistent_metadata](/graphql/core/api-reference/metadata-api/manage-metadata.mdx#metadata-get-inconsistent-metadata) API.
[get_inconsistent_metadata](/api-reference/metadata-api/manage-metadata.mdx#metadata-get-inconsistent-metadata) API.
Following the above example, the role `R` which is trying to inherit
permissions from the role `pr1` and `pr2` will be marked as inconsistent
for the table permission of the table `article`.

View File

@ -8,7 +8,7 @@ keywords:
sidebar_position: 5
---
import Thumbnail from "@site/src/components/Thumbnail";
import Thumbnail from '@site/src/components/Thumbnail';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
@ -16,41 +16,34 @@ import TabItem from '@theme/TabItem';
## Introduction
Access control rules in Hasura are defined at a role, table and action
(_insert, update, select, delete_) level granularity:
Access control rules in Hasura are defined at a role, table and action (_insert, update, select, delete_) level
granularity:
<Thumbnail
src="/img/graphql/core/auth/permission-rule-granularity.png"
alt="Access control rules in Hasura"
width="1000px"
src='/img/graphql/core/auth/permission-rule-granularity.png'
alt='Access control rules in Hasura'
width='1000px'
/>
Requests to Hasura should contain the reserved session variable
`X-Hasura-Role` to indicate the requesting user's role, and the table
and action information is inferred from the request itself. This
information is used to determine the right permission rule to be applied
(_if one has been defined_) to the incoming request.
Requests to Hasura should contain the reserved session variable `X-Hasura-Role` to indicate the requesting user's role,
and the table and action information is inferred from the request itself. This information is used to determine the
right permission rule to be applied (_if one has been defined_) to the incoming request.
Hasura converts GraphQL queries (_or mutations/subscriptions_) into a
single SQL query that is executed on the configured database instance.
Hasura also includes constraints from permission rules in the SQL query
itself.
Hasura converts GraphQL queries (_or mutations/subscriptions_) into a single SQL query that is executed on the
configured database instance. Hasura also includes constraints from permission rules in the SQL query itself.
Permissions are essentially a combination of **boolean expressions** and
**column selections** that impose constraints on the data being returned
or modified.
Permissions are essentially a combination of **boolean expressions** and **column selections** that impose constraints
on the data being returned or modified.
Let's take a look at the different configuration options available to
define a permission rule. Permission rules are defined for each role,
table, operation (_insert, select, update, delete_) by using the console
or the [metadata APIs for permissions](/graphql/core/api-reference/metadata-api/permission.mdx).
Let's take a look at the different configuration options available to define a permission rule. Permission rules are
defined for each role, table, operation (_insert, select, update, delete_) by using the console or the
[metadata APIs for permissions](/api-reference/metadata-api/permission.mdx).
## Operation permissions
### **Select** permissions
For `select` operations or for GraphQL queries, you can configure the
following:
For `select` operations or for GraphQL queries, you can configure the following:
- [Row-level permissions](#row-level-permissions)
- [Column-level permissions](#col-level-permissions)
@ -59,8 +52,7 @@ following:
### **Insert** permissions
For `insert` operations or for GraphQL mutations of the type _insert_,
you can configure the following:
For `insert` operations or for GraphQL mutations of the type _insert_, you can configure the following:
- [Row-level permissions](#row-level-permissions)
- [Column-level permissions](#col-level-permissions)
@ -69,8 +61,7 @@ you can configure the following:
### **Update** permissions
For `update` operations or for GraphQL mutations of the type _update_,
you can configure the following:
For `update` operations or for GraphQL mutations of the type _update_, you can configure the following:
- [Row-level permissions](#row-level-permissions)
- [Column-level permissions](#col-level-permissions)
@ -79,8 +70,7 @@ you can configure the following:
### **Delete** permissions
For `delete` operations or for GraphQL mutations of the type _delete_,
you can configure the following:
For `delete` operations or for GraphQL mutations of the type _delete_, you can configure the following:
- [Row-level permissions](#row-level-permissions)
- [Backend only](#backend-only-permissions)
@ -89,76 +79,67 @@ you can configure the following:
### Row-level permissions {#row-level-permissions}
Row-level permissions are **boolean expressions** that help you restrict
access to rows depending on the operation being performed. E.g. in the
case of `select`, your boolean expression is run on every row to
determine whether that row can be read. In the case of `insert`, the
boolean expression determines whether or not the mutation is allowed.
Row-level permissions are **boolean expressions** that help you restrict access to rows depending on the operation being
performed. E.g. in the case of `select`, your boolean expression is run on every row to determine whether that row can
be read. In the case of `insert`, the boolean expression determines whether or not the mutation is allowed.
Row-level permissions are defined using operators, static values, values
in columns (_including those in related tables or nested objects_) and
session variables.
Row-level permissions are defined using operators, static values, values in columns (_including those in related tables
or nested objects_) and session variables.
#### Using column operators to build rules
Type-based operators (_depending on the column type_) are available for
constructing row-level permissions. You can use the same operators that
you use to [filter query results](/graphql/core/databases/postgres/queries/query-filters.mdx) along with a few
others to define permission rules.
Type-based operators (_depending on the column type_) are available for constructing row-level permissions. You can use
the same operators that you use to [filter query results](/queries/postgres/query-filters.mdx) along with a few others
to define permission rules.
See the [API reference](/graphql/core/api-reference/syntax-defs.mdx#metadataoperator) for a list of all supported
column operators.
See the [API reference](/api-reference/syntax-defs.mdx#metadataoperator) for a list of all supported column operators.
**For example**, the following two images illustrate the different
operators available for `integer` and `text` types:
**For example**, the following two images illustrate the different operators available for `integer` and `text` types:
<Thumbnail
src="/img/graphql/core/auth/operators-for-integer-types.png"
alt="Column operators for integer types"
width="400px"
src='/img/graphql/core/auth/operators-for-integer-types.png'
alt='Column operators for integer types'
width='400px'
/>
<Thumbnail
src="/img/graphql/core/auth/operators-for-text-types.png"
alt="Column operators for text types"
width="400px"
src='/img/graphql/core/auth/operators-for-text-types.png'
alt='Column operators for text types'
width='400px'
/>
#### Using boolean expressions
The following is an example of a simple boolean expression to restrict
access for `select` to rows where the value in the `id` column is
greater than 10:
The following is an example of a simple boolean expression to restrict access for `select` to rows where the value in
the `id` column is greater than 10:
<Tabs className="api-tabs">
<TabItem value="console" label="Console">
You can define permissions using boolean expressions on the Hasura
console as follows:
You can define permissions using boolean expressions on the Hasura console as follows:
<Thumbnail
src="/img/graphql/core/auth/simple-boolean-expression.png"
alt="Using boolean expressions to build rules"
width="600px"
src='/img/graphql/core/auth/simple-boolean-expression.png'
alt='Using boolean expressions to build rules'
width='600px'
/>
</TabItem>
<TabItem value="cli" label="CLI">
You can define permissions using boolean expressions in the
`tables.yaml` file inside the `metadata` directory:
You can define permissions using boolean expressions in the `tables.yaml` file inside the `metadata` directory:
```yaml {8-10}
- table:
schema: public
name: author
select_permissions:
- role: user
permission:
columns: []
filter:
id:
_gt: 10
- role: user
permission:
columns: []
filter:
id:
_gt: 10
```
Apply the metadata by running:
@ -171,7 +152,7 @@ hasura metadata apply
<TabItem value="api" label="API">
You can define permissions using boolean expressions when using the
[permissions metadata API](/graphql/core/api-reference/metadata-api/permission.mdx):
[permissions metadata API](/api-reference/metadata-api/permission.mdx):
```http {13-15}
POST /v1/metadata HTTP/1.1
@ -197,50 +178,45 @@ X-Hasura-Role: admin
</TabItem>
</Tabs>
You can construct more complex boolean expressions using the `_and`,
`_or` and `not` operators:
You can construct more complex boolean expressions using the `_and`, `_or` and `not` operators:
<Thumbnail
src="/img/graphql/core/auth/boolean-operators.png"
alt="Using more complex boolean expressions to build rules"
width="600px"
src='/img/graphql/core/auth/boolean-operators.png'
alt='Using more complex boolean expressions to build rules'
width='600px'
/>
**For example**, using the `_and` operator, you can construct a rule to
restrict access for `select` to rows where the value in the `id` column
is greater than 10 **and** the value in the `name` column starts with
"a" or "A":
**For example**, using the `_and` operator, you can construct a rule to restrict access for `select` to rows where the
value in the `id` column is greater than 10 **and** the value in the `name` column starts with "a" or "A":
<Tabs className="api-tabs">
<TabItem value="console" label="Console">
You can define permissions using the `_and` operator on the Hasura
console as follows:
You can define permissions using the `_and` operator on the Hasura console as follows:
<Thumbnail
src="/img/graphql/core/auth/composite-boolean-expression.png"
alt="Example of a rule with the _and operator"
width="600px"
src='/img/graphql/core/auth/composite-boolean-expression.png'
alt='Example of a rule with the _and operator'
width='600px'
/>
</TabItem>
<TabItem value="cli" label="CLI">
You can define permissions using the `_and` operator in the
`tables.yaml` file inside the `metadata` directory:
You can define permissions using the `_and` operator in the `tables.yaml` file inside the `metadata` directory:
```yaml {8-11}
- table:
schema: public
name: author
select_permissions:
- role: user
permission:
columns: []
filter:
_and:
- id: {_gt: 10}
- name: {_ilike: a%}
- role: user
permission:
columns: []
filter:
_and:
- id: { _gt: 10 }
- name: { _ilike: a% }
```
Apply the metadata by running:
@ -253,7 +229,7 @@ hasura metadata apply
<TabItem value="api" label="API">
You can define permissions using the `_and` operator when using the
[permissions metadata API](/graphql/core/api-reference/metadata-api/permission.mdx):
[permissions metadata API](/api-reference/metadata-api/permission.mdx):
```http {13-26}
POST /v1/metadata HTTP/1.1
@ -292,15 +268,12 @@ X-Hasura-Role: admin
#### Using session variables
Session variables that have been resolved from authentication tokens by
either your authentication webhook or by Hasura using the JWT
configuration are available for constructing row-level permissions.
Session variables that have been resolved from authentication tokens by either your authentication webhook or by Hasura
using the JWT configuration are available for constructing row-level permissions.
**For example**, to allow an `author` to access only their articles, you
can use the `X-Hasura-User-ID` session variable to construct a rule to
restrict access for `select` to rows in the `articles` table where the
value in the `id` column is equal to the value in the session variable
(*assuming this variable is being used to indicate the author's ID*):
**For example**, to allow an `author` to access only their articles, you can use the `X-Hasura-User-ID` session variable
to construct a rule to restrict access for `select` to rows in the `articles` table where the value in the `id` column
is equal to the value in the session variable (_assuming this variable is being used to indicate the author's ID_):
<Tabs className="api-tabs">
<TabItem value="console" label="Console">
@ -308,30 +281,29 @@ value in the `id` column is equal to the value in the session variable
You can define session variables in permissions on the Hasura console:
<Thumbnail
src="/img/graphql/core/auth/session-variables-in-permissions-simple-example.png"
alt="Using session variables to build rules"
width="600px"
src='/img/graphql/core/auth/session-variables-in-permissions-simple-example.png'
alt='Using session variables to build rules'
width='600px'
/>
</TabItem>
<TabItem value="cli" label="CLI">
You can define session variables in permissions in the `tables.yaml`
file inside the `metadata` directory:
You can define session variables in permissions in the `tables.yaml` file inside the `metadata` directory:
```yaml {10-12}
- table:
schema: public
name: article
select_permissions:
- role: author
permission:
columns:
- title
- content
filter:
id:
_eq: X-Hasura-User-Id
- role: author
permission:
columns:
- title
- content
filter:
id:
_eq: X-Hasura-User-Id
```
Apply the metadata by running:
@ -344,7 +316,7 @@ hasura metadata apply
<TabItem value="api" label="API">
You can define session variables in permissions tables when using the
[permissions metadata API](/graphql/core/api-reference/metadata-api/permission.mdx):
[permissions metadata API](/api-reference/metadata-api/permission.mdx):
```http {13-15}
POST /v1/metadata HTTP/1.1
@ -372,29 +344,24 @@ X-Hasura-Role: admin
:::info Array session variables in permission rules
Support for using session variables for array operators like `_in`,
`_nin`, `_has_any_keys`, `_has_all_keys` is available in versions
`v1.0.0-beta.3` and above.
Support for using session variables for array operators like `_in`, `_nin`, `_has_any_keys`, `_has_all_keys` is
available in versions `v1.0.0-beta.3` and above.
When you use array operators such as `_in` in the permissions builder in
the Hasura console, it will automatically open an array for your values.
If your session variable value is already an array, you can click the
`[X-Hasura-Allowed-Ids]` suggestion to remove the brackets and set your
session variable in its place.
When you use array operators such as `_in` in the permissions builder in the Hasura console, it will automatically open
an array for your values. If your session variable value is already an array, you can click the `[X-Hasura-Allowed-Ids]`
suggestion to remove the brackets and set your session variable in its place.
:::
#### Using relationships or nested objects {#relationships-in-permissions}
You can leverage [table relationships](/graphql/core/databases/postgres/schema/table-relationships/index.mdx) to
define permission rules with fields from a nested object.
You can leverage [table relationships](/schema/postgres/table-relationships/index.mdx) to define permission rules with
fields from a nested object.
**For example**, let's say you have an object relationship called
`agent` from the `authors` table to another table called `agent` (*an
author can have an agent*) and we want to allow users with the role
`agent` to access the details of the authors who they manage in
`authors` table. We can define the following permission rule that uses
the aforementioned object relationship:
**For example**, let's say you have an object relationship called `agent` from the `authors` table to another table
called `agent` (_an author can have an agent_) and we want to allow users with the role `agent` to access the details of
the authors who they manage in `authors` table. We can define the following permission rule that uses the aforementioned
object relationship:
<Tabs className="api-tabs">
<TabItem value="console" label="Console">
@ -402,29 +369,28 @@ the aforementioned object relationship:
You can use a nested object to build rules on the Hasura console:
<Thumbnail
src="/img/graphql/core/auth/nested-object-permission-simple-example.png"
alt="Using a nested object to build rules"
width="600px"
src='/img/graphql/core/auth/nested-object-permission-simple-example.png'
alt='Using a nested object to build rules'
width='600px'
/>
</TabItem>
<TabItem value="cli" label="CLI">
You add permissions using relationships or nested objects in the
`tables.yaml` file inside the `metadata` directory:
You add permissions using relationships or nested objects in the `tables.yaml` file inside the `metadata` directory:
```yaml {8-11}
- table:
schema: public
name: author
select_permissions:
- role: agent
permission:
columns: []
filter:
agent:
agent_id:
_eq: X-Hasura-User-Id
- role: agent
permission:
columns: []
filter:
agent:
agent_id:
_eq: X-Hasura-User-Id
```
Apply the metadata by running:
@ -437,7 +403,7 @@ hasura metadata apply
<TabItem value="api" label="API">
You add permissions using relationships or nested objects when using the
[permissions metadata API](/graphql/core/api-reference/metadata-api/permission.mdx):
[permissions metadata API](/api-reference/metadata-api/permission.mdx):
```http {13-19}
POST /v1/metadata HTTP/1.1
@ -467,70 +433,63 @@ X-Hasura-Role: admin
</TabItem>
</Tabs>
This permission rule reads as "*if the author's agent's* `id` *is the
same as the requesting user's* `id` *, allow access to the author's
details*."
This permission rule reads as "_if the author's agent's_ `id` _is the same as the requesting user's_ `id` _, allow
access to the author's details_."
:::info Array and object relationships work similarly
- The above example would have worked even if the relationship were an
array relationship. In our example, the corresponding rule for an
array relationship would have read "*if any of this author's
agents'* `id` *is the same as the requesting user's* `id` *, allow
access to the author's details*".
- The above example would have worked even if the relationship were an array relationship. In our example, the
corresponding rule for an array relationship would have read "_if any of this author's agents'_ `id` _is the same as
the requesting user's_ `id` _, allow access to the author's details_".
- You can also check out this more elaborate
[example](/graphql/core/auth/authorization/common-roles-auth-examples.mdx#nested-object-permissions-example).
[example](/auth/authorization/common-roles-auth-examples.mdx#nested-object-permissions-example).
:::
#### Using unrelated tables / views {#unrelated-tables-in-permissions}
You can use the `_exists` operator to set a permission rule based on
tables/views that are not related to our table.
You can use the `_exists` operator to set a permission rule based on tables/views that are not related to our table.
**For example**, say we want to allow a user to `insert` an `article`
only if the value of the `allow_article_create` column in the `users`
table is set to `true`. Let's assume the user's id is passed in the
`X-Hasura-User-ID` session variable.
**For example**, say we want to allow a user to `insert` an `article` only if the value of the `allow_article_create`
column in the `users` table is set to `true`. Let's assume the user's id is passed in the `X-Hasura-User-ID` session
variable.
<Tabs className="api-tabs">
<TabItem value="console" label="Console">
You can set permissions using unrelated tables on the Hasura console as
follows:
You can set permissions using unrelated tables on the Hasura console as follows:
<Thumbnail
src="/img/graphql/core/auth/exists-permission-example.png"
alt="Use an unrelated table to build rules"
width="900px"
src='/img/graphql/core/auth/exists-permission-example.png'
alt='Use an unrelated table to build rules'
width='900px'
/>
</TabItem>
<TabItem value="cli" label="CLI">
You can set permissions using unrelated tables in the `tables.yaml` file
inside the `metadata` directory:
You can set permissions using unrelated tables in the `tables.yaml` file inside the `metadata` directory:
```yaml {7-15}
- table:
schema: public
name: article
insert_permissions:
- role: user
permission:
check:
_exists:
_where:
_and:
- id: {_eq: X-Hasura-User-Id}
- allow_article_create: {_eq: true}
_table:
schema: public
name: users
columns:
- content
- id
- title
- role: user
permission:
check:
_exists:
_where:
_and:
- id: { _eq: X-Hasura-User-Id }
- allow_article_create: { _eq: true }
_table:
schema: public
name: users
columns:
- content
- id
- title
```
Apply the metadata by running:
@ -543,7 +502,7 @@ hasura metadata apply
<TabItem value="api" label="API">
You can set permissions for unrelated tables when using the
[permissions metadata API](/graphql/core/api-reference/metadata-api/permission.mdx):
[permissions metadata API](/api-reference/metadata-api/permission.mdx):
```http {13-27}
POST /v1/metadata HTTP/1.1
@ -581,48 +540,40 @@ X-Hasura-Role: admin
</TabItem>
</Tabs>
This permission rule reads as "*if there exists a row in the table*
`users` *whose* `id` *is the same as the requesting user's* `id` *and
has the* `allow_article_create` _column set to true, allow access to
insert articles_."
This permission rule reads as "_if there exists a row in the table_ `users` _whose_ `id` _is the same as the requesting
user's_ `id` _and has the_ `allow_article_create` _column set to true, allow access to insert articles_."
### Column-level permissions {#col-level-permissions}
Column-level permissions determine access to columns in the rows that
are accessible based on row-level permissions.
Column-level permissions determine access to columns in the rows that are accessible based on row-level permissions.
<Tabs className="api-tabs">
<TabItem value="console" label="Console">
Column-level permissions are simple selections on the Hasura console:
<Thumbnail
src="/img/graphql/core/auth/column-level-permissions.png"
alt="Column level permissions"
width="600px"
/>
<Thumbnail src='/img/graphql/core/auth/column-level-permissions.png' alt='Column level permissions' width='600px' />
</TabItem>
<TabItem value="cli" label="CLI">
You can set column-level permissions in the `tables.yaml` file inside
the `metadata` directory:
You can set column-level permissions in the `tables.yaml` file inside the `metadata` directory:
```yaml {7-11}
- table:
schema: public
name: article
select_permissions:
- role: author
permission:
columns:
- author_id
- id
- content
- title
filter:
author_id:
_eq: X-Hasura-User-Id
- role: author
permission:
columns:
- author_id
- id
- content
- title
filter:
author_id:
_eq: X-Hasura-User-Id
```
Apply the metadata by running:
@ -635,7 +586,7 @@ hasura metadata apply
<TabItem value="api" label="API">
You can set column-level permissions when using the
[permissions metadata API](/graphql/core/api-reference/metadata-api/permission.mdx):
[permissions metadata API](/api-reference/metadata-api/permission.mdx):
```http {12-17}
POST /v1/metadata HTTP/1.1
@ -666,45 +617,39 @@ X-Hasura-Role: admin
</TabItem>
</Tabs>
In this example, the role `author` has only partial access to columns of
the accessible rows for the `select` operation.
In this example, the role `author` has only partial access to columns of the accessible rows for the `select` operation.
### Row fetch limit {#limit-rows-permissions}
In the case of `select` operations, the number of rows to be returned in
the response can be limited using this configuration:
In the case of `select` operations, the number of rows to be returned in the response can be limited using this
configuration:
<Tabs className="api-tabs">
<TabItem value="console" label="Console">
You can set a row fetch limit on the Hasura console as follows:
<Thumbnail
src="/img/graphql/core/auth/limit-rows-for-select.png"
alt="Row fetch limit"
width="600px"
/>
<Thumbnail src='/img/graphql/core/auth/limit-rows-for-select.png' alt='Row fetch limit' width='600px' />
</TabItem>
<TabItem value="cli" label="CLI">
You can set a row fetch limit for a table in the `tables.yaml` file
inside the `metadata` directory:
You can set a row fetch limit for a table in the `tables.yaml` file inside the `metadata` directory:
```yaml {13}
- table:
schema: public
name: author
select_permissions:
- role: user
permission:
columns:
- id
- name
filter:
user_id:
_gt: 10
limit: 20
- role: user
permission:
columns:
- id
- name
filter:
user_id:
_gt: 10
limit: 20
```
Apply the metadata by running:
@ -717,7 +662,7 @@ hasura metadata apply
<TabItem value="api" label="API">
You can a row fetch limit for a table when using the
[permissions metadata API](/graphql/core/api-reference/metadata-api/permission.mdx):
[permissions metadata API](/api-reference/metadata-api/permission.mdx):
```http {18}
POST /v1/metadata HTTP/1.1
@ -746,48 +691,44 @@ X-Hasura-Role: admin
</TabItem>
</Tabs>
In the above example, this configuration restricts the number of
accessible rows (*based on the rule*:
In the above example, this configuration restricts the number of accessible rows (_based on the rule_:
`{"id":{"_eq":"X-Hasura-User-Id"}}`) to 20.
### Aggregation queries permissions {#aggr-query-permissions}
In the case of `select` operations, access to
[aggregation queries](/graphql/core/databases/postgres/queries/aggregation-queries.mdx) can be enabled for a
given role using this configuration.
In the case of `select` operations, access to [aggregation queries](/queries/postgres/aggregation-queries.mdx) can be
enabled for a given role using this configuration.
<Tabs className="api-tabs">
<TabItem value="console" label="Console">
You can enable aggregation queries permissions on the Hasura console as
follows:
You can enable aggregation queries permissions on the Hasura console as follows:
<Thumbnail
src="/img/graphql/core/auth/aggregation-query-permissions.png"
alt="Aggregation queries permissions"
width="600px"
src='/img/graphql/core/auth/aggregation-query-permissions.png'
alt='Aggregation queries permissions'
width='600px'
/>
</TabItem>
<TabItem value="cli" label="CLI">
You can allow aggregation query permissions in the `tables.yaml` file
inside the `metadata` directory:
You can allow aggregation query permissions in the `tables.yaml` file inside the `metadata` directory:
```yaml {13}
- table:
schema: public
name: author
select_permissions:
- role: user
permission:
columns:
- id
- name
filter:
user_id:
_gt: 10
allow_aggregations: true
- role: user
permission:
columns:
- id
- name
filter:
user_id:
_gt: 10
allow_aggregations: true
```
Apply the metadata by running:
@ -800,7 +741,7 @@ hasura metadata apply
<TabItem value="api" label="API">
You can allow aggregation query permissions when using the
[permissions metadata API](/graphql/core/api-reference/metadata-api/permission.mdx)
[permissions metadata API](/api-reference/metadata-api/permission.mdx)
```http {19}
POST /v1/metadata HTTP/1.1
@ -830,38 +771,36 @@ X-Hasura-Role: admin
</TabItem>
</Tabs>
In the above example, the role `user` is allowed to make aggregation
queries.
In the above example, the role `user` is allowed to make aggregation queries.
### Column presets {#col-presets-permissions}
While this is strictly not a permission configuration, defining
[role-based column presets](/graphql/core/databases/postgres/schema/default-values/column-presets.mdx) on any column
automatically removes access to it. This preset can be defined for
`insert` and `update` operations. This configuration is also very useful
to avoid sending sensitive user-information in the request and leverage
session variables or static data instead.
[role-based column presets](/schema/postgres/default-values/column-presets.mdx) on any column automatically removes
access to it. This preset can be defined for `insert` and `update` operations. This configuration is also very useful to
avoid sending sensitive user-information in the request and leverage session variables or static data instead.
### Backend only {#backend-only-permissions}
If a permission is marked as `backend_only`, the mutation is accessible
to the given role only if `x-hasura-use-backend-only-permissions`
session variable exists and is set to `true` and request is made with
If a permission is marked as `backend_only`, the mutation is accessible to the given role only if
`x-hasura-use-backend-only-permissions` session variable exists and is set to `true` and request is made with
`x-hasura-admin-secret` set if any auth is configured.
This might be useful if you would like to hide a mutation from the
public facing API but allow access to it via a "trusted backend".
This might be useful if you would like to hide a mutation from the public facing API but allow access to it via a
"trusted backend".
Setting `backend-only` is currently available for insert, update and delete mutations.
:::tip Supported from
Back-end only permissions for `update` and `delete` mutations are supported in Hasura GraphQL engine versions `v2.8.0` and above.
Back-end only permissions for `update` and `delete` mutations are supported in Hasura GraphQL engine versions `v2.8.0`
and above.
:::
:::
:::info Additional Resources
Enterprise Grade Authorization - [Watch Webinar](https://hasura.io/events/webinar/authorization-modeling-hasura/?pg=docs&plcmt=body&cta=watch-webinar&tech=).
Enterprise Grade Authorization -
[Watch Webinar](https://hasura.io/events/webinar/authorization-modeling-hasura/?pg=docs&plcmt=body&cta=watch-webinar&tech=).
:::

Some files were not shown because too many files have changed in this diff Show More