> For the complete documentation index, see [llms.txt](https://docs.toucanai.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.toucanai.cloud/build/analyze-your-database-with-ai/how-to/analyze-your-database-with-ai.md).

# Analyze your database with AI

{% hint style="info" %}
**Target Audience**: Non technical users
{% endhint %}

### Goal

Enrich a database schema with semantic metadata to improve the quality of AI-powered queries and visualizations.

***

### Prerequisites

* A [connected and active database](/build/data-connections/how-to/add-a-database.md) (e.g., PostgreSQL or Google BigQuery).

***

### Steps

#### **1.** Access the Database Schema

* Navigate to the **Databases** section.
* Select the specific database for analysis.
* View the list of identified tables and their current structure.

#### 2. Execute AI Analysis

* Click the **Analyze** button in the top-right corner of the database view
* **Select Schemas & Tables**: In the "Select schemas to analyze" modal, use the checkboxes to choose the specific schemas and tables you wish to enrich.
  * Click the **Analyze** button within the modal to launch the enrichment process.
* **Monitor Progress**: Monitor the loading bar as Toucan.ai samples the selected data.
* **Verification**: Wait for the "Enriched" status to appear on the tables before proceeding.

<figure><img src="/files/pchipWr66RkQE1pXwl7u" alt="Analyze Database"><figcaption></figcaption></figure>

#### 3. Review and Refine

* Select a table to view its Structure tab.
* Verify that the Semantic Field Type is accurate.
* Modify Display Names or Descriptions to provide better context for natural language prompts.

#### 4. Validate Data and Security

* Use the Preview tab to inspect a limited sample of the data records.
* Access the Access Rules (Row-Level Security) tab to map user attributes to specific table columns:
  * Define Logical Rules: Beyond simple mapping, you can now use operators to create complex access logic (e.g., `Department` contains `Sales`).
  * Multi-Condition Logic: Use the + AND or + OR buttons to group conditions for a single table.
  * Attribute Mapping: RLS operations compare Dataset Fields against User Attributes (provided via your authentication token).

***

#### Constraints

* **Ambiguity**: Field type inference may be incorrect for columns with generic naming or data.
* **Schema Evolution**: You must re-run the analysis if the underlying database structure changes.
* **Preview Limits**: The Preview tab is for validation only and is not intended for reporting.

***

### Conclusion

The database now contains the semantic context necessary for the AI assistant to interpret user prompts. You may now proceed to create charts in the Library or finalize security rules in the Govern phase.

**Suggested Next Step**: [How-to: Create a dashboard with AI](/build/dashboards-and-layouts/how-to/create-a-dashboard-with-ai.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.toucanai.cloud/build/analyze-your-database-with-ai/how-to/analyze-your-database-with-ai.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
