Skip to main content
After creating a structured knowledge base, you connect it to a database and explore the imported schema. This guide walks you through entering connection credentials, browsing tables, and enriching metadata.

Connect your database

Enter the connection credentials for your database. Connect External Data Source dialog showing database type selector and credential fields for Host, Port, Database Name, Username, Password, and SSL Mode. Database credential entry form with fields for Host, Port, Database Name, Username, Password, and SSL Mode, along with connection test and submit buttons. After a successful connection, IdeaBoxAI imports the database schema automatically.

Explore the Datasets view

Once connected, the Datasets view displays a schema visualization of your database.
  • Data Sets sidebar: Lists all imported database tables.
  • Table relationships: Shows joins and foreign key relationships between tables.
  • AI enrichment: Options to enhance metadata with AI, add semantic definitions, and define relationships.
Datasets view showing database tables in the sidebar, table relationships in the main panel, and options to enhance with AI, add semantics, and define relationships. From this view you can:
  • Browse all database tables and their columns.
  • Define joins and relationships between tables.
  • Enhance schema metadata using AI assistance.
  • Document business logic for columns and tables.
Best practices
  • Validate relationships against source database constraints.
  • Avoid circular or ambiguous joins.
  • Document semantic definitions clearly so agents can reason about your data.
The result is a semantically enriched data model ready for analytics and AI queries through cubes.

Query with the SQL Editor

Once your database is connected and its schema is explored, you can query it directly using the built in SQL Editor, a real query workbench inside the knowledge base rather than a plain text box. Where: open a structured knowledge base and select the Editor tab. The sidebar splits into Tables and Queries, and the header shows which database engine you’re connected to along with a read only badge, since every query run from the Editor executes as a read only statement. SQL Editor showing a saved query, its natural language description, the generated SQL, and a result set with row count and elapsed time in the footer. From the Editor you can:
  • Browse the schema: every table and column in the knowledge base is listed in the sidebar. Click one to insert it into your query, correctly qualified for the connected engine.
  • Run: executes your query as read only and paged, with a row cap and a statement timeout. The footer reports rows returned, elapsed time, and the engine that was reached.
  • Validate: static checks plus an optional AI review of your query, each returning a labeled advisory so you know exactly what it’s flagging.
  • Suggest SQL: describe what you want in plain language and get a draft query built from the knowledge base’s real schema and dialect. A starting point, not a final answer.
  • Format: tidy up a query’s formatting.
  • History: recall what you’ve run earlier in the session.
  • Copy or export to CSV: take a result set out of the Editor.
  • Save: store a query together with a name, an example question, or both, so it can be reused later.
  • Manage queries: search, filter, enable or disable, edit, or delete saved queries from the same view.
Table names are qualified the way your connected engine actually resolves them, not just however they read on screen. Snowflake, for example, has no default database or schema for a session, so a query written as ORDERS won’t resolve, while SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.ORDERS will. The Editor, autocomplete, and Suggest SQL all qualify names automatically for the engine you’re connected to.

Saved queries

Saving a query does more than store it for your own reuse. Once a query is saved, Persona AI can find and run that exact query instead of writing a new one from scratch. Tables and Queries sidebar in the SQL Editor, showing a saved query listed under the Queries tab. This matters because generating SQL from a question is not deterministic. The same question, asked on different days, can produce two different queries, with different totals to match, even though both look correct. A saved query removes that variance: the same question always runs the same SQL against current data, every time. When you ask Persona AI a question, it checks for a saved query first, in order of confidence:
  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 version of a saved question still resolves to it. If nothing matches, Persona AI says so and generates a fresh query instead, rather than guessing at a saved query that doesn’t fit.

Turning a generated query into a saved one

When Persona AI generates a new query and runs it successfully, you can promote that exact result with Save as a reusable query on the result card. This saves the precise query that ran, not a rewritten or re-generated version of it, so the saved pair matches exactly what was already reviewed.
A saved query is not a cache. It re-runs against live data every time, so results stay current even though the query itself is fixed. The SQL Editor is new and still being finalized. A few known issues to watch for:
  • Manually typed or pasted queries may not show the New Query and Save options.
  • Selecting a table from the schema sidebar doesn’t always auto populate its schema context.
  • If a database’s schema changes after a query is saved (a renamed column, a dropped table), the saved query does not yet detect this automatically. Verify saved queries after a schema change on the connected database.