Back to Graphql Engine

BigQuery: Rename Relationships

docs/docs/schema/bigquery/table-relationships/rename.mdx

2.49.21.2 KB
Original Source

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

BigQuery: Rename Relationships

An existing relationship can be renamed as follows:

<Tabs groupId="user-preference" className="api-tabs"> <TabItem value="console" label="Console">
  • Head to Data -> [table-name] -> Relationships in the Console
  • Drop the existing relationship
  • Recreate the relationship with the new name
</TabItem> <TabItem value="api" label="API"> <!-- TODO: BigQuery Metadata docs: https://github.com/hasura/graphql-engine/issues/8560 -->

You can rename a relationship by using the bigquery_rename_relationship metadata API:

http
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin

{
  "type": "bigquery_rename_relationship",
  "args": {
    "source": "<db_name>",
    "dataset": "bigquery",
    "table": "articles",
    "name": "article_details",
    "new_name": "article_detail"
  }
}
</TabItem> </Tabs>

:::info Note

You might not be allowed to drop a relationship if it has been referenced elsewhere (e.g. in a permissions rule).

In this case you will have to delete the references first, rename the relationship, and then re-add the references.

:::