Query tools and saved queries

A chat can fetch data for you without you writing SQL: the Mind writes the query, runs it, and saves it as a named query you can open, fix, download or reuse later. To run SQL by hand, see write SQL in the Editor.

Ask a Mind to run a query

  1. In a chat, describe the result you need, such as a count, a list or a total. The Mind writes the SQL and runs it in one step.
  2. Read the reply: the result arrives in pages of up to 50 rows, with the total number of rows found, and you can ask for the next page.
  3. Each run appears as a step in the chat; open it to see the SQL above the rows. See Tool cards and Tool History.
  4. The query is saved as a named query in a category in the chat's artifacts. Find it later in Artifacts.

A chat keeps one query per name. When a later message changes the query, the updated version replaces the previous one instead of adding copies with names like _fix or _v2, and the earlier versions stay in the query's history. The query tools read data; they do not change it.

Fix a saved query without rewriting it

Ask for the change in the chat that saved the query. The Mind edits the stored SQL in place, in one of three ways:

The edit saves under the same name and replaces the previous version; earlier versions stay in the query's history, which you can open from Artifacts.

Keep and reuse a saved query

Turn a saved query into a Warehouse view

Convert to View publishes a saved query to the Warehouse as a database view. You need Add/Modify Warehouse Objects; the view needs a name and at least one logical model. The administrator permission group always applies to the view and is not shown. For the steps and what a view is, see Artifacts and Views.

Questions, answered

Can a Mind write and run SQL for me?

Yes. Describe the result you need in plain words; the Mind writes the SQL, runs it against the data it can reach, and replies with the rows. The query is saved as a named query in the chat's artifacts, ready to fix, download or reuse.

Why did the Mind update my old query instead of creating a new one?

A chat keeps one query per name. The updated version replaces the previous one, so there are no duplicates with names like _fix or _v2. The earlier versions stay in the query's history.

How do I reach the next page of a large result?

Ask for the next page in the chat; each page carries up to 50 rows. A saved query opened from Artifacts loads its rows from the server in pages of up to 10,000 rows.

Can I fix part of a query instead of rewriting it?

Yes. The Mind can replace the exact lines that are wrong, find and replace a piece of text, or replace the whole SQL when the change is larger. Only the changed part moves; the rest stays as it was.

The Mind says it cannot find my query. Why?

Queries are saved inside the chat that made them, under their exact name. Ask in that chat, or open the query from Artifacts; the refusal reads Query "…" not found.

What does "Query rejected: disallowed schema reference" mean?

The SQL reached for tables outside the data the chat can read, so the query was refused. Ask for the tables by name; if the Mind cannot reach them at all, link the tables to the Mind or use a Mind that already has them. See Link data to a Mind.

Why was a query that reads a file or URL refused?

Chats query tables, not outside helpers. SQL that pulls data through a helper such as a file, a URL or a lookup function is refused with Query rejected: a lake query may not read through … - query the lake tables directly. Ask for the data as a table instead.

Can I run a saved query again later?

Yes. Ask the Mind in the chat that saved it to run the query by name; it can show its details, such as the category and when it last ran, and page through the rows again.

Can I turn a saved query into a Warehouse view?

Yes, with Convert to View: the query becomes a database view in the Warehouse. You need Add/Modify Warehouse Objects; the view needs a logical model, and the administrator permission group always applies to it and is not shown. For the steps, see Artifacts.

Do results show personal data as tokens?

No. Before a result is saved to its grid, personal-data tokens are resolved back to their values, so cells show the data itself.