Example
“Compare sales by department this quarter”
| Method | Process | Time |
|---|---|---|
| Write SQL yourself | Write SQL → execute → interpret | 10–30 min |
| Ask the data team | Request → wait → receive | Hours to days |
| DbSphere | Natural-language question → instant answer + chart | 10 sec |

NL-to-SQL Pipeline
| Stage | Description |
|---|---|
| Schema analysis | The AI analyzes connected table structure and column descriptions |
| SQL generation | Converts the natural-language question to SQL in the right DB dialect |
| Safety check | Allows only SELECT queries; blocks INSERT, UPDATE, DELETE, etc. |
| Run query | Executes validated SQL on the database |
| NL response | Converts query results to natural-language text or chart |
Supported Databases
10 databases are supported by default.| Database | Type | Strengths |
|---|---|---|
| PostgreSQL | RDBMS | Advanced features, JSON support, open-source |
| MySQL | RDBMS | Most widely used RDBMS |
| Microsoft SQL Server | RDBMS | Enterprise environments |
| Oracle | RDBMS | Large enterprise |
| SQLite | RDBMS | Lightweight embedded database |
| Snowflake | Cloud DW | Cloud data warehouse |
| BigQuery | Cloud DW | Google Cloud data warehouse, service account key auth |
| Databricks | Lakehouse | Databricks SQL Warehouse, Delta Lake integrated |
| Azure Synapse | Cloud DW | Azure unified analytics platform |
| Microsoft Fabric | Lakehouse / DW | Power BI integrated analytics environment |
DBSPHERE_TYPES environment variable.Connect a Database
Create a new connection

| Field | Description | Example |
|---|---|---|
| Name | Connection display name | ”Sales Analytics DB” |
| Description | Database purpose | ”Sales team revenue data” |
| DB type | Database type | PostgreSQL |
Enter connection info
| Field | Description |
|---|---|
| Host | DB server address |
| Port | Connection port |
| Database name | DB name to connect to |
| Username | DB account |
| Password | DB password |
Per-DB additional fields
Per-DB additional fields
| DB Type | Additional Fields | Description |
|---|---|---|
| Snowflake | Account, Warehouse, Role, Schema | Snowflake account identifier, warehouse, role, schema |
| PostgreSQL | Schema | Schema name (default: public) |
| MSSQL | Schema | Schema name (default: dbo) |
| SQLite | Database (file path) | No host/port/auth — only the DB file path |
| BigQuery | Project ID, Dataset, Service Account JSON | GCP project ID, default dataset, service account key (paste JSON). No host/port/username/password |
Add schema descriptions (optional)

Example schema description
Example schema description
Set tool description (optional)
Example tool description
Example tool description
How the AI Generates SQL
When you connect a DB to an agent, user questions go through this process to become SQL.Memory System
DbSphere uses 4 types of memory to improve SQL generation accuracy. The more memory, the more accurate the AI’s queries.| Memory | Badge | Content | Creation |
|---|---|---|---|
| DDL Schema | DDL | Table structure + column descriptions | Auto on schema extraction |
| SQL Memory | SQL | Question-SQL pairs (past successful queries) | Auto-accumulated on query success |
| Documentation | DOC | Business terms, rules, context | Manual entry |
| SQL Example | EX | Reference SQL examples (use case, tags) | Manual entry or auto on extraction |

SQL Memory is Key
SQL Memory is a few-shot learning memory where successful queries are auto-saved.| Use Count | SQL Memory | AI Behavior |
|---|---|---|
| First | 0 | Guess SQL from schema only |
| 5 | 5 | Generate referencing similar past queries |
| 50+ | 50+ | Generate accurate SQL using validated patterns |
Documentation Use
Tell the AI about business rules it doesn’t know via Documentation.| Type | Example |
|---|---|
| Term | ”MRR is the abbreviation for Monthly Recurring Revenue, stored in the monthly_revenue column” |
| Rule | ”When aggregating revenue, orders with status=‘cancelled’ must be excluded” |
| Context | ”Customer tiers are 4 levels: S/A/B/C, with S being the highest” |
Data Visualization
Based on SQL execution results, the AI auto-generates appropriate charts.| Chart Type | Suitable Data |
|---|---|
| Bar | Comparison by category |
| Line | Time-series trend |
| Pie | Ratio / composition |
| Scatter | Correlation |
| Heatmap | Cross analysis |
| Histogram | Distribution |
| Grouped bar | Multi-dimensional comparison |
| Table | Detailed data |
Querying Databases
Connect to an Agent
- In the agent edit screen, click ”+ Add” in the “Database” section
- Pick the database to connect
- Save
Use in Chat
When you chat with an agent that has databases connected, the AI analyzes the question and auto-generates and runs SQL.Example Questions
- Revenue Analysis
- Customer Analysis
- Inventory
- HR
Reviewing SQL Execution Results
A “SQL Query” button appears below the AI response. Click to see the actual SQL run and detailed results.| Feature | Description |
|---|---|
| View SQL | Show the executed SQL with formatting (uppercase keywords, indentation) |
| Copy SQL | Copy SQL to clipboard — useful when re-running in a separate query tool |
| Result table | View query results as a table |
| CSV download | Save results as a CSV file |
DB Dialect Differences
Each DB has slightly different SQL syntax. Cloosphere dynamically injects per-DB dialect rules into the system prompt when converting natural language to SQL, guiding the AI to produce correct SQL. Still, expressing intent clearly produces more accurate SQL.Key Differences
| Item | PostgreSQL | MySQL | Oracle | MSSQL/Synapse/Fabric | SQLite | Snowflake | BigQuery | Databricks |
|---|---|---|---|---|---|---|---|---|
| Identifier quoting | "name" | `name` | "NAME" | [name] | "name" | "NAME" | `name` | `name` |
| LIMIT expression | LIMIT n | LIMIT n | FETCH FIRST n ROWS ONLY | TOP n | LIMIT n | LIMIT n | LIMIT n | LIMIT n |
| Date literal | '2026-04-26' | '2026-04-26' | TO_DATE('2026-04-26', 'YYYY-MM-DD') | '2026-04-26' | '2026-04-26' | '2026-04-26' | DATE '2026-04-26' | '2026-04-26' |
| Date format function | TO_CHAR() | DATE_FORMAT() | TO_CHAR() | FORMAT() | strftime() | TO_CHAR() | FORMAT_DATE() | date_format() |
| Date arithmetic | + INTERVAL '1 day' | DATE_ADD(d, INTERVAL 1 DAY) | + 1 (direct) | DATEADD(day, 1, d) | date(d, '+1 day') | DATEADD(day, 1, d) | DATE_ADD(d, INTERVAL 1 DAY) | date_add(d, 1) |
| String concat | || | CONCAT() | || | + | || | || | CONCAT() | || |
| Empty string = NULL | ✗ | ✗ | ✓ ⚠️ | ✗ | ✗ | ✗ | ✗ | ✗ |
| Case-sensitive identifiers | When quoted ✓ | Default ✗ | Uppercase by default | Default ✗ | When quoted ✓ | When quoted ✓ | Default ✗ | When quoted ✓ |
System Auto-Correction vs. User Responsibility
Handled automatically:- Dashboard period filter (
$st/$edplaceholders): auto-converted to per-DB date literals - Identifier quoting during Knowledge Graph value extraction: auto-selects per-DB quotes
- Per-DB dialect rules dynamically injected into the AI’s system prompt (LIMIT, date, identifiers, etc.)
- When you write Korean/special-char column names directly in natural-language queries — the AI may miss quotes and fail
- Oracle empty-string comparisons (see Oracle quirks below)
- Complex window functions and CTEs vary by DB — verify AI output
Oracle DB Quirks
Oracle has some behaviors that differ from ANSI SQL — worth knowing.Empty strings are treated as NULL ⚠️
Empty strings are treated as NULL ⚠️
'' (empty string) the same as NULL. So conditions like the following always return 0 rows:Date literals must use TO_DATE()
Date literals must use TO_DATE()
$st/$ed) auto-substitute as TO_DATE(...) when using Oracle. But you must specify it yourself when writing SQL directly in the SQL result screen.Date arithmetic uses direct ± instead of INTERVAL
Date arithmetic uses direct ± instead of INTERVAL
TRUNC(col, 'DD') instead of DATE_TRUNC(), and TO_CHAR(col, 'D') instead of EXTRACT(DOW FROM col) for day-of-week.Quoting Korean/special-char column names
Quoting Korean/special-char column names
AS 공장코드) directly causes ORA-00936: missing expression.Use FETCH FIRST instead of LIMIT
Use FETCH FIRST instead of LIMIT
Security
Read-only
DbSphere only executes SELECT queries. Data modification is not possible.| Allowed | Blocked |
|---|---|
| SELECT | INSERT, UPDATE, DELETE |
| Aggregate functions (COUNT, SUM, AVG) | DROP, ALTER, TRUNCATE |
| JOIN, subqueries | CREATE, GRANT |
Credential Protection
- DB passwords are stored encrypted
- Connection info is only viewable by users with access permission
Best Practices
Database Account Setup
- Create a dedicated account: Make a read-only account just for AI use
- Grant least privilege: Grant SELECT permission only on needed tables
- Set query limits: Configure timeout and result row limits
Table Selection
- Pick only what’s needed: Connecting all tables can confuse the AI
- Exclude sensitive data: Always exclude tables with PII or passwords
- Pick related tables together: Pick tables that need to JOIN together
Schema Description Writing
- Korean descriptions encouraged: Describe tables and columns using business terminology
- Add business context: Document possible values and meanings of “status” columns
- State relationships explicitly: Describe foreign-key relationships and JOIN conditions
Troubleshooting
Connection test fails
Connection test fails
| Cause | Solution |
|---|---|
| Network issue | Check firewall rules, VPN connection |
| Auth failure | Re-verify account, password, permissions |
| Port blocked | Verify the DB port is open |
| SSL config | Check SSL certificate requirements |
The AI generates wrong SQL
The AI generates wrong SQL
| Cause | Solution |
|---|---|
| Insufficient schema description | Add detailed descriptions for tables and columns |
| Business rules not reflected | Add rules to Documentation memory |
| Related tables missing | Pick tables that need JOIN together |
| Ambiguous question | Include specific conditions (date range, filters) in the question |
| No past reference queries | Add correct query examples to SQL Example memory |
Slow responses
Slow responses
| Cause | Solution |
|---|---|
| Large data volume | Add conditions like date range to the question |
| Complex query | Simplify the question or break into multiple |
| DB performance | Optimize indexes, check DB resources |
FAQ
Can the data be modified?
Can the data be modified?
SELECT is blocked immediately.Can I see the executed SQL?
Can I see the executed SQL?
Can I JOIN multiple tables?
Can I JOIN multiple tables?
Can one agent connect multiple databases?
Can one agent connect multiple databases?
What's different when picking a model during schema extraction?
What's different when picking a model during schema extraction?

