Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Views are supported as alternatives to tables in Data API builder (DAB). A view can be exposed through GraphQL endpoints with minimal configuration.
Configuration
To expose a view:
- Set
source.typeto"view" - Set
source.objectto the fully qualified view name - To identify a row uniquely, define
key-fields - Grant permission using the
"read"action (and optionally"create","update","delete"if the view is updatable)
CLI example
dab add BookDetail \
--source dbo.vw_books_details \
--source.type "view" \
--fields.name "id" \
--fields.primary-key "true" \
--permissions "anonymous:read"
Configuration example
"BookDetail": {
"source": {
"type": "view",
"object": "dbo.vw_books_details",
"key-fields": [ "id" ]
},
"permissions": [
{
"role": "anonymous",
"actions": [ "read" ]
}
]
}
GraphQL behavior
- View appears as a GraphQL type
- Queries are always supported
- Mutations are supported only if the view is updatable
- Follows standard DAB GraphQL schema structure
Example query
{
bookDetails {
items {
id
title
authorName
}
}
}
Permissions
- Use the
readaction for readonly views - Use
create,update, anddeleteonly if the view is updatable
Limitations
key-fieldsare required- Views don't support relationships
- Pagination, filtering, and sorting are supported if the view behaves like a table