---
title: Explore sample data with Genie Code
description: Ask Genie Code questions about sample data in Unity Catalog tables, views, Streaming tables, and AI Search indexes, then review or auto-run the generated SQL.
canonical_url: https://docs.databricks.com/gcp/en/genie-code/sample-data-explorer
---

# Explore sample data with Genie Code

Sample Data Explorer uses Genie Code to let you ask natural-language questions about sample data in your Unity Catalog tables, then generates SQL from table metadata and row-level samples. Review each query before running it, or configure Sample Data Explorer to auto-run queries.

Sample Data Explorer supports the following table types:

* Managed, external, and foreign tables
* Views and materialized views
* Streaming tables
* AI Search indexes

![Sample Data Explorer demo](https://assets.docs.databricks.com/_static/images/genie-code/sample-data-explorer-demo.gif)

## Requirements

* Unity Catalog must be enabled in your workspace. See [Get started with Unity Catalog](https://docs.databricks.com/gcp/en/data-governance/unity-catalog/get-started.md).
* Genie Code must be enabled. See [Genie Code features and capabilities](https://docs.databricks.com/gcp/en/genie-code/features-capabilities.md).

You must have the `SELECT` privilege on the target table, as well as `USE SCHEMA` on the parent schema, and `USE CATALOG` on the parent catalog.

## Explore sample data

To explore sample data for a table:

1. In your Databricks workspace, click ![Data icon.](https://docs.databricks.com/gcp/en/images/product-icons/DataIcon.svg) **Catalog**.

2. Select the table that you want to explore.

3. Click the **Sample data** tab.

4. In the prompt box, ask Sample Data Explorer a question about the data. Typical questions include:
   * Asking about table properties: "Is there a field with contact information?"
   * Getting quick stats: "How many trips happened after 8 PM?"
   * Debugging and running partial SQL: "select deployable\_account\_id, order by descending DATE."

5. Genie Code returns an answer to your question, along with a generated SQL query. If it's your first time using Sample Data Explorer, it might prompt you to choose how queries are run:
   * Click **Yes** to have Genie Code automatically run generated queries. Genie Code runs the query and returns the answer immediately.
   * Click **No, run manually** to review the generated SQL before running it.

6. If Sample Data Explorer is configured to run queries manually, it displays the **Run query** and **Open in Editor** buttons after each response. Click **Run query** to run the query, or **Open in Editor** to modify it.

You can modify the auto-run setting at any time by clicking the ![Kebab menu icon.](https://docs.databricks.com/gcp/en/images/product-icons/OverflowIcon.svg) icon to the right of the prompt box, then selecting **Auto-run queries** or **Run manually**.

![Configure auto-run queries for Sample Data Explorer](https://docs.databricks.com/gcp/en/images/genie/sample-data-explorer-auto-run.png)
