The Knowledge Catalog (formerly Dataplex Universal Catalog) data insights feature automatically generates
descriptions, relationship graphs, and SQL queries from your table and dataset
metadata. This information helps you quickly understand data structure, content,
and relationships without extensive manual setup. To investigate further, you
can ask follow-up questions in [data canvas](https://docs.cloud.google.com/bigquery/docs/data-canvas.md.txt).

When exploring a new, unfamiliar table, data analysts often face difficulty
knowing how to start writing queries. The problem can involve
uncertainties about the data structure and key patterns in the data.
The Knowledge Catalog data insights feature offers an automated way to
explore and understand your data. This lets you uncover patterns, assess data
quality, and perform statistical analysis.

> [!NOTE]
> **Note:** To provide feedback on this feature, email [dataplex-data-insights-help@google.com](mailto:dataplex-data-insights-help@google.com).

## Overview

Data insights use Gemini to analyze your metadata and generate the
following:

- Descriptions: AI-generated summaries explaining the purpose of the dataset or
  namespace, the structure of the table, and the details of specific columns.

- Sample queries: Tailored GoogleSQL and Spark SQL queries
  designed specifically for the schema and content of your dataset, namespace,
  or table.

  > [!NOTE]
  > **Note:** Spark SQL is only supported for BigLake Iceberg REST Catalog tables.

- Relationship graphs: Visualizations that show the connections and
  dependencies between different tables within your dataset or namespace.

In addition, data insights supports **custom instructions (Preview)**. Custom
instructions let data stewards set up how insights are generated by
providing specific business objectives, domain knowledge, and organizational
vocabulary.

## Supported resources

Data insights are available for the following structured data types:

- BigQuery datasets, tables, and views
- Borderless Lakehouse tables (including Apache Iceberg, Apache Hive, and SAP BDC)
- External tables
- Apache Iceberg REST Catalog tables
- Apache Iceberg namespaces (represented as datasets in BigQuery)
- Apache Hive catalog tables
- SAP Business Data Cloud (BDC) tables

## Example of an insights run

Data insights automatically generates natural language queries and their SQL
equivalents based on a table's metadata. For Iceberg
tables, data insights also generates Spark SQL equivalents.

### Example: SQL insights

Consider a table called `telco_churn` with the following schema:

| Field name | Type |
|---|---|
| CustomerID | `STRING` |
| Gender | `STRING` |
| Tenure | `INT64` |
| InternetService | `STRING` |
| StreamingTV | `STRING` |
| OnlineBackup | `STRING` |
| Contract | `STRING` |
| TechSupport | `STRING` |
| PaymentMethod | `STRING` |
| MonthlyCharges | `FLOAT` |
| Churn | `BOOLEAN` |

The following are some of the sample queries that data insights
generates for this table:

- Identify customers who have subscribed to all premium services and have been
  a customer for more than 50 months.

  ```sql
  SELECT
    CustomerID,
    Contract,
    Tenure
  FROM
    agentville_datasets.telco_churn
  WHERE
    OnlineBackup = 'Yes'
    AND TechSupport = 'Yes'
    AND StreamingTV = 'Yes'
    AND Tenure > 50;
  ```
- Identify which internet service has the most churned customers.

  ```sql
  SELECT
    InternetService,
    COUNT(DISTINCT CustomerID) AS total_customers
  FROM
    agentville_datasets.telco_churn
  WHERE
    Churn = TRUE
  GROUP BY
    InternetService
  ORDER BY
    total_customers DESC
  LIMIT 1;
  ```
- Identify churn rates by segment among high-value customers.

  ```sql
  SELECT
    Contract,
    InternetService,
    Gender,
    PaymentMethod,
    COUNT(DISTINCT CustomerID) AS total_customers,
    SUM(CASE WHEN Churn = TRUE THEN 1 ELSE 0 END) AS churned_customers,
    (SUM(CASE WHEN Churn = TRUE THEN 1 ELSE 0 END) / COUNT(DISTINCT CustomerID))
    * 100 AS churn_rate
  FROM
    agentville_datasets.telco_churn
  WHERE
    MonthlyCharges > 100
  GROUP BY
    Contract,
    InternetService,
    Gender,
    PaymentMethod;
  ```

### Example: Spark SQL insights

Consider an Apache Iceberg table called `catalog_metrics` with the following
schema:

| Field name | Type |
|---|---|
| details | `STRUCT` |
| creation_date | `DATE` |
| creation_time | `TIMESTAMP` |
| precise_measure | `DOUBLE` |
| price | `DOUBLE` |
| metadata | `STRUCT` |
| is_active | `BOOLEAN` |

The following are some of the sample Spark SQL queries that data insights
generates for this table:

- Calculate the cumulative sum of `precise_measure` ordered by `creation_time`
  for each `details.field1`.

  ```sql
  SELECT
    details.field1,
    creation_time,
    precise_measure,
    SUM(precise_measure) OVER (PARTITION BY details.field1 ORDER BY creation_time) AS cumulative_precise_measure
  FROM
    PROJECT_ID.DATASET_ID.catalog_metrics;
  ```
- Get the maximum price for each `details.field1` and `details.field2`
  combination, but only for records created in the last 30 days.

  ```sql
  SELECT
    details.field1,
    details.field2,
    MAX(price) AS max_price
  FROM
    PROJECT_ID.DATASET_ID.catalog_metrics
  WHERE
    creation_date >= DATE_SUB(CURRENT_DATE(), 30)
  GROUP BY
    details.field1,
    details.field2;
  ```
- Get the average `metadata.value` for items with `is_active` set to `false`.

  ```sql
  SELECT
    AVG(metadata.value) AS avg_value
  FROM
    PROJECT_ID.DATASET_ID.catalog_metrics
  WHERE
    is_active = false;
  ```

## Modes for generating data insights

When generating data insights, Knowledge Catalog provides
two modes:

| Mode | Description | Usage |
|---|---|---|
| **Generate and publish** | Persists generated data insights into Knowledge Catalog as metadata aspects. You must have the necessary permissions to publish. When you use **Generate and publish**, the following actions occur: - Stores table and column descriptions in Knowledge Catalog. - Captures suggested queries and questions as reusable aspects. - Makes published insights accessible to all users who have appropriate Knowledge Catalog access, ensuring shared organizational knowledge. - Lets you edit and save descriptions directly in Knowledge Catalog. | Use this mode for enterprise-wide data documentation that persists and is reusable, or when building catalog-driven governance workflows. |
| **Generate without publishing** | Creates data insights such as descriptions, natural language questions, and SQL queries on demand. **Generate without publishing** doesn't publish insights to Knowledge Catalog. | Use this mode for quick, ad hoc exploration to avoid cluttering the catalog. |

## Pricing

For details about pricing for this feature, see
[Data Cloud Agent pricing](https://cloud.google.com/products/data-agents/pricing).

To track token consumption for data insights scan jobs and build custom
dashboards in Cloud Monitoring, see
[Monitor data insights token usage](https://docs.cloud.google.com/knowledge-catalog/docs/monitor-insights-token-usage.md.txt).

## Quotas and limits

To learn how to manage costs and set limits on data insights token usage, see
[Quotas and limits for data insights](https://docs.cloud.google.com/knowledge-catalog/docs/quotas.md.txt#data-insights-quotas).

## Locations

You can use data insights in all
[BigQuery locations](https://docs.cloud.google.com/bigquery/docs/locations.md.txt). To learn about
where Gemini in BigQuery processes your data, see
[Where Gemini in BigQuery processes your data](https://docs.cloud.google.com/bigquery/docs/gemini-locations.md.txt).

## Limitations

- For multi-cloud customers, data from other clouds isn't available.
- Data insights doesn't support `Geo` or `JSON` column types.
- Insights runs don't guarantee the presentation of queries every time. To increase the likelihood of generating more engaging queries, regenerate insights in BigQuery Studio.

## What's next

- Learn how to [generate insights for structured data in Knowledge Catalog](https://docs.cloud.google.com/knowledge-catalog/docs/use-data-insights-structured-data.md.txt).
- Learn how to [generate insights in BigQuery](https://docs.cloud.google.com/bigquery/docs/data-insights.md.txt#insights-bigquery-table).
- Learn how to [monitor data insights token usage](https://docs.cloud.google.com/knowledge-catalog/docs/monitor-insights-token-usage.md.txt).
- Learn how to [generate a data profiling scan](https://docs.cloud.google.com/knowledge-catalog/docs/use-data-profiling.md.txt).
- Learn how to [write queries with Gemini assistance in BigQuery](https://docs.cloud.google.com/bigquery/docs/write-sql-gemini.md.txt).