> For the complete documentation index, see [llms.txt](https://endash-guidance-docs.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://endash-guidance-docs.gitbook.io/docs/data/build-and-modify-a-data-model-with-our-ai-query.md).

# Build and modify a data model with our AI query

* Introducing our AI-powered query that automates the process of crafting SQL queries to tailor-fit your data model needs. With its advanced capabilities, our tool streamlines the often complex and time-consuming task of creating SQL queries, ensuring they align perfectly with your needs. Say goodbye to manual query writing and hello to efficient and precise data modeling with our innovative solution.

***

## Create a new data model with AI query

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FsP3hEnRMA7rkwoYKBUrJ%2Fimage.png?alt=media&amp;token=abf50404-06a4-479d-8edb-44f7965fdd2f" alt=""><figcaption></figcaption></figure>

* Follow up when you are on [Build - Data mode](/docs/data/data-model-details/build-data-model.md)l page with the [Query method](/docs/data/build-a-data-model.md#the-query-method), in the **AI prompt bar**, input what you want to build in it.

{% hint style="info" %}
You can try an example prompt like this: *Build me a data model with 5 columns in analysis ad bigquery*
{% endhint %}

* If the **AI prompt bar** has an input, clicking the **X** icon will clear all your input; clicking the ▶ icon button will let the AI begin to visualize your input.

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FThs4YB6IxFIibwJ7iBC5%2Fimage.png?alt=media&amp;token=5086b970-0ab1-4f35-b08a-a423328140a8" alt=""><figcaption></figcaption></figure>

* The right screen shall show you how our AI directly writes the query.&#x20;

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2F1TfT7UccZTGaDfE02eT9%2Fimage.png?alt=media&amp;token=712676d5-f18f-4ed7-b30b-6608dc1828cd" alt=""><figcaption></figcaption></figure>

* Click Use to select the queries.
* Click Don't use to restart again.

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FGMGsdSQgLPPYndHsKBZg%2Fimage.png?alt=media&amp;token=9fb63fac-b3f3-4d02-9a6d-540bb3f2ee1c" alt=""><figcaption></figcaption></figure>

* The query will be auto-executed.
* Scroll down to the data model that has been created by those queries.

## Edit a data model with the AI query&#x20;

<figure><img src="https://1608311007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSr8m3Ldc2W7Qqq1jsjgC%2Fuploads%2FFrusuOFfXuHKvEm8E4Iv%2Fimage.png?alt=media&amp;token=1eed5751-b6d7-44e7-bead-45108a8b6782" alt=""><figcaption></figcaption></figure>

* You can also use the AI query to edit any of existed data models.

***

{% hint style="info" %}
Remember to Save if the AI query has generated the data model that you want.
{% endhint %}
