> 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-1.md).

# Copy of Analyze your database with AI

### Objective

In this tutorial, we will show you how to analyze your connected database using AI to enrich the context of future prompts and generate more relevant charts and dashboards.

***

### Prerequisites

You must have already [connected a database](https://toucan-toco.gitbook.io/toucan-ai/build/data-connections/supported-databases) (see the first tutorial on how to add a database).

***

### Steps

#### 1. Access Your Database

* Once your database is connected, go to the **Databases** section and click on the database you want to analyze from the list.

#### 2. Explore the Database Schema

* Once you're inside the database, you will be able to see its schema and the various tables it contains.
* On the left side of the screen, you will see a list of tables in the database, *such as HR data, sales data, video game data, or climate data for instance.*

#### 3. View the Table Structure

* On the right side of the screen, the structure of the database is displayed.
* You will see column names, display names in the dashboard, data types, and an option to manually set data types using a dropdown. You can also add descriptions for each column.

#### 4. Use AI to Analyze the Database

* Toucan AI is intelligent enough to understand your data structure. To enrich the database context automatically, click on the **Analyze** button in the top-right corner.
* Once clicked, a loading bar will appear, and after a few seconds, all tables will be analyzed. You will see the table descriptions and column descriptions being automatically completed.

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

#### 5. Review and Adjust the Descriptions

* AI will detect field types and try to interpret them. For example, if a field was marked as a string, but it contains dates, Toucan AI will recognize it as a date type based on the data inside that column.
* These descriptions can be manually adjusted to improve the context and provide better insights for future visualizations. It's crucial to refine these descriptions to ensure highly relevant charts and dashboards are generated.

#### 6. Add More Context Manually

* *Although this is not yet a full **semantic layer**, it is coming soon in Toucan AI. You can continue to fine-tune the database context by adding detailed and precise descriptions for each table and column.*

<figure><img src="/files/APqL3gefCLaxEDMXTCk6" alt="Database Metadata"><figcaption></figcaption></figure>

#### 7. Preview Your Data and Apply Security

* Alongside the table structure, you will also see two additional buttons:
  * **Preview**: Clicking this will show a preview of your data.
  * **RLS (Row Level Security)**: This feature will be discussed in later tutorials, as it allows you to apply data security at a granular level.

***

### Conclusion

Congratulations! You have successfully analyzed your database with AI, which will help you create more relevant charts and dashboards in future steps.

**Suggested** **Next Steps**: discover [how-to create a chart with AI](https://toucan-toco.gitbook.io/toucan-ai/build/charts/how-to/create-a-chart-with-ai)!


---

# 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-1.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.
