Skip to main content

Overview

Integrate your data with tools like Power BI, Tableau, and Looker by creating Data Views of your Datagrid Knowledge, enabling seamless connections and visualization without the hassle.

Complete Implementation

Here’s a complete implementation showing the full flow from creating knowledge to obtaining BigQuery connector credentials:
import os
from datagrid_ai import Datagrid

datagrid_client = Datagrid(
    api_key=os.environ.get("DATAGRID_API_KEY"),
)

# Step 1: Create Knowledge from file(s)
with open("./data/sales-q4.csv", "rb") as file:
    knowledge = datagrid_client.knowledge.create(
        name="Sales Data Q4",
        files=[file],
    )

# Step 2: Create a Service Account
service_account = datagrid_client.data_views.service_accounts.create(
    name="bigquery-connector",
    type="gcp",
)

# Step 3: Create a Data View linking knowledge to service account
data_view = datagrid_client.data_views.create(
    knowledge_id=knowledge.id,
    service_account_id=service_account.id,
    name="Sales Data View",
)

# Step 4: Get Service Account Credentials to view your Data Views via a BigQuery connector
credentials = datagrid_client.data_views.service_accounts.credentials(
    service_account.id
)