<!-- Generated from the rendered page by scripts/write-llm-mirrors.mjs. Do not edit by hand. -->
Canonical: https://molo17.com/ai-hub/sql-ai/
Markdown mirror: https://molo17.com/ai-hub/sql-ai/index.md
Title: SQL AI · Gluesync AI Hub · MOLO17
Description: Gluesync SQL AI: Query Studio AI chat and Tab autocomplete plus the gluesync.ai virtual table through Query Forge. Plain-language questions become reviewable SQL and result rows under your models, keys, and permissions.

[Gluesync AI Hub](/ai-hub/) · Query Studio AI · gluesync.ai

# Ask in plain language. Get SQL you can read, and rows you can trust.

SQL AI is Gluesync's answer path for everyone who already works in SQL. Inside the Control Plane, Query Studio AI drafts and completes statements from the schema it already knows. From any JDBC client, the gluesync.ai virtual table turns a question into one result row with the answer, a reviewable SQL proposal, and a conversation you can continue. Your models, your keys, the caller's permissions, read-only by default.

[Book a demo](/book-a-demo/) [Read the gluesync.ai contract](https://docs.molo17.com/gluesync/latest/core-hub/ai-as-sql.html)

1.  01 Ask in Query Studio or SELECT FROM gluesync.ai
2.  02 Review the proposed SQL; nothing executes on its own
3.  03 Run it as yourself, read-only, with PII masked

Two surfaces, one contract

## Where you work decides how you ask.

Inside the Control Plane

### Query Studio AI

A chat that already knows your schema and a Tab autocomplete that finishes the statement you started. The draft lands in the editor; you review it, then run it under Query Studio permissions.

-   Schema-grounded chat, no agent setup required
-   Suffix-only ghost text: it proposes what comes next, never rewrites what you typed
-   PII-tagged columns are masked before anything reaches the model
-   Same bring-your-own vault, keys, and providers as AI Studio

[See it in Query Studio →](/query-studio/#query-studio-ai)

From any JDBC client

### gluesync.ai through Query Forge

A virtual table Core Hub owns and Query Forge serves like any other. DataGrip, DBeaver, Tableau, or a batch job asks a question in SQL and reads the answer back as a row.

-   One row: answer, proposed\_sql, citations, conversation\_id
-   Name grounding resolves pipeline, agent, schema, and table from the question
-   spark\_agent runs a published AI Studio agent with read-only tools only
-   proposed\_sql is a draft for review; Gluesync never executes it

[See it in Query Forge →](/query-forge/#sql-callable-ai)

How it works

## Grounded, drafted, reviewed. In that order.

1.  01
    
    Ground
    
    ### The schema Gluesync already knows
    
    SQL AI reads the schemas, tables, columns, and keys discovered through the agents Gluesync integrates, plus the Enterprise brain's graph and memory. Name a pipeline, agent, schema, or table in the question and Core Hub resolves the scope; explicit IDs win when you pin them.
    
2.  02
    
    Draft
    
    ### SQL you can read before you run
    
    Query Studio AI drops the draft into the editor and completes the statement you are typing with suffix-only ghost text. gluesync.ai returns proposed\_sql in the row. Either way the SQL is visible, explainable, and yours to edit.
    
3.  03
    
    Review and run
    
    ### Your identity, your controls
    
    Execution follows the caller's Core Hub role, the per-user data-access matrix, Query Studio's read-only defaults, and PII masking. There is no AI service account, and no path around the permissions you already set.
    

The gluesync.ai row

## One SELECT, one row, everything you need for the next step.

The shortest valid query is a question. Add `spark_agent` to put a published agent behind the answer, `provider_id` to pin a model from the vault, or `conversation_id` to continue the exchange. Only equality predicates on these columns are accepted; everything else fails with a SQLSTATE your code can handle.

**`answer`:** Plain-language result, grounded in the schema the caller can already see
**`proposed_sql`:** A SQL draft for review. Never auto-executed
**`citations`:** JSON text with the schema and documentation the answer leaned on
**`conversation_id`:** Pass it back in the next WHERE clause to ask a follow-up
**`pipeline_id · agent_id`:** The scope Core Hub resolved from names in the question, or NULL
**`provider_id · spark_agent`:** The vault provider and published agent used, when you chose one

Query Forge · any JDBC client

```
SELECT answer, proposed_sql, conversation_id
FROM gluesync.ai
WHERE question = 'in the crm-sync pipeline, find customers
                  with duplicate emails in dbo.CUSTOMERS'
  AND spark_agent = 'Ops helper';
```

answer Found 42 CUSTOMERS rows sharing an email in the crm-sync source. The proposal below groups by EMAIL and has not been executed.

proposed\_sql `SELECT EMAIL, COUNT(*) FROM dbo.CUSTOMERS GROUP BY EMAIL HAVING COUNT(*) > 1;`

conversation\_id `b5acd3d2-7c9d-4100-8296-25b10132ebe0`

Capabilities

## Everything SQL AI does in Gluesync 2.3

Two surfaces, one contract: the question is grounded in the schema the caller can see, the SQL is a proposal until a person or a governed job runs it, and the answer never carries more than the caller could read.

Query Studio AI

### Schema-grounded chat

Open the helper from the Query Studio launcher and ask for the data you need. The draft uses the database, schema, and editor context already visible in your workspace.

-   No agent or allow-list setup required
-   Works with any chat model in the vault
-   Conversations stay in your Core Hub

[Query Studio →](/query-studio/#query-studio-ai)

Query Studio AI

### Tab autocomplete

Press Tab while you write. The helper proposes what comes next as ghost text and never rewrites what you already typed.

-   Suffix-only completions
-   Accepts the editor's current dialect and schema
-   Same provider, same permissions as chat

gluesync.ai

### A virtual table any client can read

Query Forge serves gluesync.ai like a regular table. SELECT with a question predicate, read one row back. Prepared parameters are accepted, so applications bind the question instead of concatenating it.

-   answer, proposed\_sql, citations, conversation\_id
-   Works in DataGrip, DBeaver, Tableau, and batch jobs
-   SQLSTATE errors you can handle in code

[Query Forge →](/query-forge/#sql-callable-ai)

gluesync.ai

### Name grounding

Mention a pipeline, agent, schema, or table in the question and Core Hub grounds the answer on the strongest unique match, returning the resolved pipeline\_id and agent\_id in the row.

-   Whole names, case-insensitive, punctuation as separator
-   Agent beats pipeline, table beats schema
-   Ties fail loudly; nothing resolved runs with empty grounding

gluesync.ai

### Spark agents from SQL

spark\_agent names a published AI Studio agent by id or unique name. Query Forge applies its instructions and the intersection of its allow-list with the read-only catalog.

-   The agent's assigned provider, or provider\_id to override
-   Write tools never run on this path
-   The agent's reply is the answer column

[AI Studio →](/capabilities/ai-studio/)

gluesync.ai

### Conversations in SQL

Pass the conversation\_id from the previous row in the next WHERE clause and the follow-up keeps the context: limit that query to active customers, add the region, explain the join.

-   Stateful follow-ups from a stateless client
-   The row always returns the id for the next turn
-   Owner-private conversations stored in the Enterprise brain

Safety

### PII masked, read-only, no auto-exec

Columns classified as personal data are tagged in Query Studio, masked in the grid, copies, and exports, and never sent to the model in clear. SQL AI only uses read-only tools and never runs its own proposal.

-   classify\_table and classify\_schema return labels only
-   Per-user, per-connection data-access matrix, deny wins
-   Managers can unmask a column for one session

[Security →](/capabilities/security/)

Scheduling

### From draft to nightly job

Save the reviewed SQL as a Query Studio query. Chronos runs saved queries or custom SQL on a schedule, from a platform event, from a webhook, or as a step in a chained event, and Spark can reopen the same library.

-   Chronos query\_studio action with read-only or write acknowledgement
-   list\_saved\_queries and get\_saved\_query for Spark and MCP clients
-   120-second execution window per run

[AI Workflows →](/ai-hub/ai-workflows/)

Reach

### 16 dialect engines and MongoDB

Query Studio speaks the dialect of each connected engine, and MongoDB connections accept JSON, mongosh, or SQL. SQL AI drafts in the dialect of the agent you selected.

-   PostgreSQL, Oracle, SQL Server, Db2, MySQL, and more
-   IBM i and midrange estates through Gluesync agents
-   Federated reads across isolated agents with Query Forge

[Integrations →](/integrations/)

What enterprises do with it

## New answer paths for teams that never left SQL.

SQL AI does not ask the business to adopt a new tool. It gives the tools they already trust a way to ask, and gives IT a contract it can govern.

BI and reporting

### The dashboard asks the question

A Tableau or DataGrip user runs a gluesync.ai query from the connection they already have. No HTTP client, no API key handling, no copy-paste between tools. The answer and its SQL draft arrive as columns.

Analyst onboarding

### Day one on an unfamiliar schema

A new analyst opens Query Studio on a 900-table ERP replica, asks which tables carry the customer identifier, and gets a grounded draft instead of a week of guessing. Tab completion turns intent into joins they can read.

Legacy estates

### IBM i, Db2, and Oracle in plain language

Gluesync already replicates from the systems no AI vendor connects to. SQL AI reasons over the schema Gluesync discovers and queries the replica read-only, so the mainframe ledger answers a business question without a new agent on the host.

Data quality

### Duplicate, orphan, and drift checks on demand

Ask for duplicate customer emails, orders without a customer, or rows that drifted between source and target. Review the proposed SQL, save it as a Query Studio query, and let Chronos run it every night.

Compliance

### Find PII without reading PII

classify\_table and classify\_schema return labels only. Tagged columns are masked in the grid, copies, exports, and model prompts, and a per-user data-access matrix decides who may unmask a column for one session.

Applications

### An assistant behind a prepared statement

Bind the user's question as a JDBC parameter, read answer and proposed\_sql from the result set, keep conversation\_id for the follow-up. Your application gains an AI answer path with the database driver it already ships.

Operations

### Ask the ops agent from the SQL console

spark\_agent = 'Ops helper' puts a published Spark agent behind the row. Summarize replication lag, explain a stuck entity, or list yesterday's dead letters without leaving the SQL client that is already open.

Federated questions

### One question across isolated agents

Query Forge already joins data across isolated Gluesync agents. SQL AI grounds the question on every schema visible to the caller's token, so a cross-system answer does not need a warehouse load first.

[All AI use cases →](/ai-hub/use-cases/) [AI as SQL solution →](/solutions/ai-as-sql/) [AI on legacy databases →](/solutions/ai-on-legacy/) [Enterprise brain →](/ai-hub/enterprise-brain/)

FAQ

## SQL AI: questions we hear

Does SQL AI ever execute the SQL it proposes?

No. Query Studio AI places the draft in the editor and gluesync.ai returns it in the proposed\_sql column. A person, a saved query, or a Chronos Query Studio action runs it, under the caller's permissions and Query Studio's read-only defaults.

Which model answers, and where do my credentials live?

Both surfaces use the bring-your-own LLM vault configured in AI Studio: OpenAI, OpenAI-compatible endpoints, Anthropic, Azure OpenAI, or a local Ollama model that never leaves your network. Credentials stay encrypted in Core Hub. gluesync.ai accepts provider\_id to pin a provider per query.

Can a gluesync.ai query change data?

No. The virtual table only offers the read-only MCP tools the caller's token may already use, never elevates permissions, and never runs proposed\_sql. The worst a question can do is cost tokens.

What does the model see from my tables?

Schema names, column names and types, the question, and tool results the caller could read anyway. Columns classified as PII are masked before they reach the model, and Query Studio data-access rules decide which schemas and tables take part in grounding.

What happens when a question names two things that match equally?

gluesync.ai fails with SQLSTATE 22023 and lists the candidates rather than picking one. Rephrase so one name wins, or pin the scope with pipeline\_id and agent\_id together. When nothing in the question resolves, the query runs with empty grounding instead of failing.

Do I need to set up a Spark agent first?

No. Query Studio AI and the generic gluesync.ai helper work with a configured provider alone. spark\_agent is optional: name a published AI Studio agent by id or unique name when you want its instructions and allow-listed read-only tools behind the answer.

Gluesync AI Hub

## Keep exploring

[Overview **Gluesync AI Hub**

The agent platform inside your data control plane: your models, Core Hub tools, and existing permissions.

Explore →](/ai-hub/) [Foundation **Enterprise brain**

The shared schema graph, memory, skills, and company tools behind every Spark agent and every AI client you connect.

Explore →](/ai-hub/enterprise-brain/) [Workspace **AI Studio**

Chat with governed Spark agents, publish immutable versions, route across your models, and govern spend from one workspace.

Explore →](/capabilities/ai-studio/) [Automation **AI Workflows**

Published agents fired by Chronos schedules, platform events, webhooks, chained steps, and your own applications.

Explore →](/ai-hub/ai-workflows/) [Outcomes **AI use cases**

What data, operations, engineering, security, and business teams actually do with Spark agents on their own data.

Explore →](/ai-hub/use-cases/) [Agent layer **Spark**

The Gluesync AI agent layer: Core Hub MCP tools, documentation and knowledge tools, and the caller's permissions on every call.

Explore →](/spark/)

Gluesync AI Hub

## Your SQL tools already speak the language. Now they can ask.

Bring your own model, keep your own keys, and give every SQL client in the company an answer path that stays inside your permissions. Query Studio AI and gluesync.ai are included in Gluesync 2.3.

[Book a demo](/book-a-demo/) [Get Gluesync](/get-gluesync/)
