Skip to main content
A structured knowledge base holds data organized in rows and columns, from a SQL database or spreadsheet files. This guide walks through creating one, exploring its schema, querying it, and reviewing the SQL Persona AI writes from it.

Create a structured knowledge base

1

Start a new knowledge base

Open the More group in the left navigation, click Knowledge base, then click Create Knowledge Base and choose Structured Data.
2

Name it

Enter a Name (up to 60 characters), and optionally a Description and Tags. Click Create.
3

Choose a data source

Under Spreadsheet, choose CSV or Excel. Under Database Connection, choose your database, such as postgres, mysql, snowflake, bigquery, sql_server, clickhouse, or actian. Click Next.
4

Add your data

For a spreadsheet, click Upload Files and add your files. Each file shows its status, and Processed means it’s ready. For a database, enter your connection details. Click Next.
Connect Your External Knowledge Base step, showing CSV and Excel spreadsheet options and database connection options such as mysql, postgres, snowflake, and bigquery.

Database connection details

After a successful connection, IdeaBoxAI imports the database schema automatically.

Explore the Canvas

Once your data is in, the knowledge base opens on the Canvas tab, which shows your tables and how they connect. Canvas tab showing two tables with their columns and relationships, the Tables and Queries sidebar, and the Enhance with AI button.
  • Tables sidebar: Lists every table in the knowledge base. Search to find one.
  • Table cards: Each table shows its columns and data types.
  • Relationships: Each table lists its joins to other tables. Click + to add one, or Select to choose existing ones.
  • Enhance with AI: Improve your schema’s metadata with AI, such as descriptions and meanings for tables and columns.
  • Zoom: Use the controls in the lower-left corner to zoom in, zoom out, or fit the view.
Best practices
  • Check relationships against your source database’s constraints.
  • Avoid circular or ambiguous joins.
  • Describe tables and columns clearly so Persona AI can reason about your data.

Use your knowledge base in chat

There are two ways to make a knowledge base available to Persona AI:
  • In a chat: Select the knowledge base from the chat input before you ask your question. It appears as a tag above your message.
  • In a project: Add it to a project’s Knowledge Bases section, and every chat in the project can use it. See Projects. Then ask your question in plain language, such as “From the sales pipeline data, I need a list of the accounts, their owner, region, and fiscal quarter with the quota.” Persona AI writes and runs the SQL for you.

Query with the SQL Editor

The SQL Editor is a query workbench inside the knowledge base. To open it, select the Editor tab. The header shows the knowledge base, its source type, and a read-only badge, because every query runs as a read-only statement. SQL Editor tab showing the read-only badge, Name and Example question fields, the Enabled toggle, Run, Suggest SQL, Validate, Format, and Save buttons, and the Results, Messages, and Validation tabs. From the Editor you can:
  • Run: Run your query, or press Cmd+Enter (Ctrl+Enter on Windows). Queries run read-only and paged, with a row limit and a timeout.
  • Suggest SQL: Describe what you want in plain language and get a draft query built from the knowledge base’s schema.
  • Validate: Check your query with static checks and an optional AI review.
  • Format: Tidy up a query’s formatting.
  • History: Recall queries you’ve run earlier.
  • New query: Clear the editor and start a new query.
  • Review the output: See your data on the Results tab, any messages on the Messages tab, and warnings about your query on the Validation tab. The footer shows rows returned, elapsed time, and the source.
  • Copy or export: Click Copy or CSV above the results to take them out of the Editor.
  • Save: Give the query a Name, an Example question in the words a user would actually ask, or both, then click Save so it can be reused. Use the Enabled toggle to turn a saved query on or off.
  • Browse the schema: Open the sidebar to see every table and column. Click one to insert it into your query, correctly qualified for the connected engine.
Table names are qualified the way your connected engine resolves them. Snowflake, for example, has no default database or schema, so a query written as ORDERS won’t resolve, while SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.ORDERS will. The Editor, autocomplete, and Suggest SQL, qualify names automatically.

Saved queries

Once a query is saved, Persona AI can find and run that exact query instead of writing a new one. Your saved queries are listed on the Queries tab of the sidebar. Search them by name, or click Manage queries to manage them all. Click a saved query to open it in the Editor. SQL Editor with a saved query open, showing the Queries tab in the sidebar, the query's name and example question, the From editor badge, and the Versions and Update buttons.
  • Source: A badge shows where the query came from, such as From editor.
  • Versions: See earlier versions of the query.
  • Update: Save your changes to the query.
This matters because generating SQL from a question isn’t always the same. The same question asked on different days can produce two different queries with different totals. A saved query removes that variance: the same question always runs the same SQL against current data. When you ask a question, Persona AI checks for a saved query first, in this order:
  1. An exact match on the query’s name.
  2. An exact match on the question it was saved with.
  3. A close match in meaning, so a rephrased question still finds it. If nothing matches, Persona AI says so and generates a fresh query.
A saved query isn’t a cache. It re-runs against live data every time, so results stay current.

Review and correct SQL in chat

When Persona AI answers a question from your data, it shows the complete SQL it wrote and ran. Expand Execute Query in the response to see it.

Confirm the result to save the query

Persona AI only saves a query when you confirm the result. Check the answer, then tell Persona AI it’s correct in the same chat, for example, “The result looks correct.” Persona AI then saves the query to the knowledge base it ran against, so it can reuse that exact SQL for similar questions. Persona AI chat after the user confirms the result, showing that the query was saved and a spreadsheet was created with Download and Share buttons. To see the saved query, open the knowledge base from More > Knowledge base, select it, and open the Queries tab in the sidebar.
You can confirm and ask for more in the same message, such as “The result looks correct. Export to a spreadsheet.”

Correct the query

If the query isn’t quite right, correct it before you confirm:
1

Edit the query

Click Edit on the Execute Query step. The SQL opens in an editor.
2

Correct the SQL

Make your changes. You can also explain the change in Why does this need correcting? This is optional.
3

Validate it

Click Validate to check that the corrected SQL runs.
4

Save the correction

Click Save correction, or Cancel to discard your changes.
Your original SQL is always kept alongside your correction. Every correction records who made it and when, and follows your workspace’s permissions. Execute Query step in a Persona AI response, open for editing, with the SQL editor, the Why does this need correcting? field, and the Validate, Save correction, and Cancel buttons.
You can also ask Persona AI to change the query for you in the same chat.