Metadata API Reference: Logical models
Introduction
Track/untrack Logical Models in the Hasura GraphQL Engine.
Logical models are supported from v2.26.0.
pg_track_logical_model
pg_track_logical_model
is used to add a Logical Model to the GraphQL schema.
Track a Logical Model as follows:
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "pg_track_logical_model",
"args": {
"source": "default",
"name": "<name>",
"fields": [
{
"name": "<field name>",
"type": "<PostgreSQL field type>",
"nullable": false | true,
"description": "<optional field description>"
},
...
]
}
}
The type of each field can be either a PostgreSQL data type or references to other Logical Models, and each field can be marked as nullable or not, see LogicalModelType.
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
fields | false | Array of LogicalModelField | Configuration for each field exposed by the Logical Model GraphQL type |
pg_untrack_logical_model
pg_untrack_logical_model
is used to remove a Logical Model from the GraphQL schema.
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "pg_untrack_logical_model",
"args": {
"source": "default",
"name": "<name>"
}
}
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
pg_create_logical_model_select_permission
pg_create_logical_model_select_permission
is used to add a permission to an existing Logical Model.
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "pg_create_logical_model_select_permission",
"args": {
"source": "default",
"name": "<logical model name>",
"role": "<role name>",
"permission": {
"columns": "*" | [
"column 1",
"column 2",
...
],
"filter": <boolean expression>
}
}
}
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
role | true | RoleName | Name of the role |
permission | true | LogicalModelSelectPermission | Permission configuration |
pg_drop_logical_model_select_permission
pg_drop_logical_model_select_permission
is used to drop an existing Logical Model permission.
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "pg_drop_logical_model_select_permission",
"args": {
"source": "default",
"function": "get_articles",
"role": "user"
}
}
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
role | true | RoleName | Name of the role |
mssql_track_logical_model
mssql_track_logical_model
is used to add a Logical Model to the GraphQL schema.
Track a Logical Model as follows:
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "mssql_track_logical_model",
"args": {
"source": "default",
"name": "<name>",
"fields": [
{
"name": "<field name>",
"type": "<SQL Server field type>",
"nullable": false | true,
"description": "<optional field description>"
},
...
]
}
}
The type of each field can be either a SQL Server data type or references to other Logical Models, and each field can be marked as nullable or not, see LogicalModelType.
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
fields | false | Array of LogicalModelField | Configuration for each field exposed by the Logical Model GraphQL type |
mssql_untrack_logical_model
mssql_untrack_logical_model
is used to remove a Logical Model from the GraphQL schema.
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "mssql_untrack_logical_model",
"args": {
"source": "default",
"name": "<name>"
}
}
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
mssql_create_logical_model_select_permission
mssql_create_logical_model_select_permission
is used to add a permission to an existing Logical Model.
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "mssql_create_logical_model_select_permission",
"args": {
"source": "default",
"name": "<logical model name>",
"role": "<role name>",
"permission": {
"columns": "*" | [
"column 1",
"column 2",
...
],
"filter": <boolean expression>
}
}
}
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
role | true | RoleName | Name of the role |
permission | true | LogicalModelSelectPermission | Permission configuration |
mssql_drop_logical_model_select_permission
mssql_drop_logical_model_select_permission
is used to drop an existing Logical Model permission.
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "mssql_drop_logical_model_select_permission",
"args": {
"source": "default",
"function": "get_articles",
"role": "user"
}
}
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
role | true | RoleName | Name of the role |
bigquery_track_logical_model
bigquery_track_logical_model
is used to add a Logical Model to the GraphQL schema.
Track a Logical Model as follows:
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "bigquery_track_logical_model",
"args": {
"source": "default",
"name": "<name>",
"fields": [
{
"name": "<field name>",
"type": "<BigQuery field type>",
"nullable": false | true,
"description": "<optional field description>"
},
...
]
}
}
The type of each field can be either a BigQuery data type or references to other Logical Models, and each field can be marked as nullable or not, see LogicalModelType.
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
fields | false | Array of LogicalModelField | Configuration for each field exposed by the Logical Model GraphQL type |
bigquery_untrack_logical_model
bigquery_untrack_logical_model
is used to remove a Logical Model from the GraphQL schema.
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "bigquery_untrack_logical_model",
"args": {
"source": "default",
"name": "<name>"
}
}
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
bigquery_create_logical_model_select_permission
bigquery_create_logical_model_select_permission
is used to add a permission to an existing Logical Model.
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "bigquery_create_logical_model_select_permission",
"args": {
"source": "default",
"name": "<logical model name>",
"role": "<role name>",
"permission": {
"columns": "*" | [
"column 1",
"column 2",
...
],
"filter": <boolean expression>
}
}
}
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
role | true | RoleName | Name of the role |
permission | true | LogicalModelSelectPermission | Permission configuration |
bigquery_drop_logical_model_select_permission
bigquery_drop_logical_model_select_permission
is used to drop an existing Logical Model permission.
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "bigquery_drop_logical_model_select_permission",
"args": {
"source": "default",
"function": "get_articles",
"role": "user"
}
}
Args syntax
Key | Required | Schema | Description |
---|---|---|---|
source | false | SourceName | Name of the source database (default: default ) |
name | true | LogicalModelName | Name of the Logical Model |
role | true | RoleName | Name of the role |