Skip to main content
POST
/
data-views
Python
import os
from datagrid_ai import Datagrid

client = Datagrid(
    api_key=os.environ.get("DATAGRID_API_KEY"),  # This is the default and can be omitted
)
data_view = client.data_views.create(
    knowledge_id="knowledge_id",
    name="name",
    service_account_id="service_account_id",
)
print(data_view.id)
{
  "object": "data_view",
  "id": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "knowledge_id": "<string>",
  "service_account_id": "<string>"
}
For a complete guide on setting up Data Views including creating knowledge, service accounts, and obtaining BigQuery credentials, see the Creating Data Views Introduction.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
knowledge_id
string
required

The id of the knowledge to create a data view for.

service_account_id
string
required

The id of the service account that will access this data view.

name
string
required

The name of the data view.

Response

201 - application/json

Successfully created data view

The data_view object represents a view into a knowledge source that can be accessed through a service account.

object
enum<string>
required

The object type, which is always data_view.

Available options:
data_view
id
string
required

The data view identifier.

created_at
string<date-time>
required

The ISO string for when the data view was created.

knowledge_id
string
required

The id of the knowledge this data view is for.

service_account_id
string
required

The id of the service account that can access this data view.