- Home
- Skills
- Business & Operations
- Text-to-SQL BI Assistant: PostgreSQL, MySQL, SQLite, CSV
Text-to-SQL BI Assistant: PostgreSQL, MySQL, SQLite, CSV
Your agent reads your database schema, writes one SQL query in the right dialect, runs it read-only, and answers with the key figures, the result table and the SQL it used.
$5
What it does
- Answers business questions (revenue, margins, rankings, trends) by writing and running SQL on your data
- Reads your schema first: tables, join paths, real category values and number ranges
- Blocks every write: only one SELECT runs, on a read-only connection, with time and row limits
- Connects to PostgreSQL and MySQL/MariaDB servers, SQLite files or CSV exports
- Learns your metrics: saves the answers you confirm and reuses them for similar questions
Who it's for
Business and data analysts
Ad-hoc questions answered with the SQL shown, so every figure can be checked and reused.
Try asking: “Which products had the highest profit margins last month?”
Small business owners
Figures from your sales exports without writing SQL or waiting for a dashboard.
Try asking: “Which month of 2025 had the highest revenue, and how does it compare with the same month in 2024?”
Developers and BI students
A safe way to explore a PostgreSQL, MySQL or SQLite database or star schema from their agent.
Try asking: “Quel est le chiffre d'affaires par catégorie pour 2024 ?”
Text-to-SQL BI Assistant: PostgreSQL, MySQL, SQLite, CSV
Example session with this skill installed
Build the text-to-sql-bi demo database and tell me which store had the best margin rate in 2025.
- Read your context and instructions
- Compiled the text-to-sql bi assistant
Summary
Monastir Marina had the best margin rate in 2025:
26.8% (190,577 TND of margin on 711,011 TND of revenue). The spread between stores is small, from 26.3% to 26.8%, so no store is a clear outlier. Lac 2 brings in the most revenue (781,645 TND) and the most margin in value.
Margin rate by store, 2025
| store_name | city | revenue_tnd | margin_tnd | margin_rate_pct |
|---|---|---|---|---|
| Monastir Marina | Monastir | 711010.83 | 190576.62 | 26.8 |
| Ariana Soukra | Ariana | 715415.06 | 190101.48 | 26.6 |
| Lac 2 | Tunis | 781645.39 | 207458.71 | 26.5 |
| Sfax Ville | Sfax | 711982.44 | 188576.85 | 26.5 |
| Sousse Corniche | Sousse | 735723.92 | 195186.80 | 26.5 |
| Gabes | Gabes | 706668.90 | 185827.77 | 26.3 |
| Tunis Centre | Tunis | 676557.98 | 178099.94 | 26.3 |
The query (run read-only)
SELECT s.store_name, s.city,
ROUND(SUM(f.revenue), 2) AS revenue_tnd,
ROUND(SUM(f.revenue) - SUM(f.cost), 2) AS margin_tnd,
ROUND((SUM(f.revenue) - SUM(f.cost)) / SUM(f.revenue) * 100, 1) AS margin_rate_pct
FROM fact_sales f
JOIN dim_store s ON s.store_key = f.store_key
JOIN dim_date d ON d.date_key = f.date_key
WHERE d.year = 2025
GROUP BY s.store_name, s.city
ORDER BY margin_rate_pct DESC
Assumption: margin rate = (revenue − cost) / revenue, with revenue after discounts.
Next steps
- Ask "Break down Monastir Marina's margin by product category" to see what drives it.
- Confirm this answer is right and I will save it to the example bank, so similar questions are answered faster next time.
Connects securely to your tools. The creator never sees your data.
About this skill
Ask your data questions, get checked answers
"Which store had the best margin in 2025?" "Top 5 B2B customers?" "Quel est le CA par catégorie ?" Ask in plain English or French. Your agent reads your database schema, writes one SQL query in the right dialect, runs it read-only, and answers with the key figures, the result table and the SQL it used.
Works on your data
- PostgreSQL and MySQL / MariaDB servers
- SQLite files (.sqlite, .db)
- CSV exports: one command turns a folder of CSV files into a database (delimiter and column types detected, codes like 007 kept as text)
Your server password never appears in commands or answers: the connection URL is read from an environment variable and masked in error messages.
Cannot change your data
- Only one
SELECT(orWITH … SELECT) statement is accepted - PostgreSQL and MySQL: every query runs in a READ ONLY transaction that is always rolled back; system schemas and risky server functions (
pg_read_file,INTO OUTFILE,LOAD_FILE,SLEEP, locks…) are refused - SQLite: the file is opened read-only and an authorizer blocks writes,
PRAGMA,ATTACHand system tables - Queries stop after 10 seconds and results are capped at 200 rows
- You can hide tables, for example a table with personal data
If the guard refuses a query, the agent stops and tells you: it never tries to work around it. For the strongest protection on a server, connect with a database user that has SELECT rights only.
Gets better with use
Answers you confirm are saved in a small example bank for that database. The closest examples are retrieved for each new question, so your own metric definitions are reused. It works offline, in English and French.
Easy to try
A demo retail warehouse (60,000 sales lines, 2024–2025, 32 solved questions) lets you try it in one minute, with no database to set up.
Limits
SQL Server, Oracle and other databases are not connected directly: export the tables to CSV first.
Works with PostgreSQL, MySQL/MariaDB, SQLite and CSV. SQL Server, Oracle and other databases are not connected directly: export the tables to CSV first. One query per question, read-only, stopped after 10 seconds and capped at 200 rows (both adjustable). Example search matches shared words, not meaning, so it helps most when questions are phrased like earlier ones.
Python 3.9+, no API key. SQLite/CSV: standard library only. PostgreSQL: pip install "psycopg[binary]". MySQL/MariaDB: pip install pymysql. Server URLs are read from an environment variable (env:DATABASE_URL) and masked in errors. Scripts: inspect_db.py (dialect, schema, join paths, real values), run_query.py (exit codes 0 OK, 1 error, 2 refused), examples.py (per-database bank of verified question-to-SQL pairs, local embedder), csv_to_sqlite.py. Guard: one SELECT/WITH; SQLite read-only file + authorizer; PostgreSQL/MySQL READ ONLY transaction always rolled back, system schemas and file/session/lock functions refused; table allowlist; timeout; row cap. Tested on PostgreSQL 16 and MariaDB 10.11.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 day ago
- Software
Python 3.9+
- Optional
- PostgreSQLMySQL
Permissions
Terminal: runs the Python scripts. Read files: the SQLite or CSV files the user points to. Write files: the example bank (.examples.json) and an optional CSV export of results. Network: only to reach the user's own PostgreSQL or MySQL server, and only when they connect one. Environment variables: reads the connection URL from the variable the user names (for example DATABASE_URL), so the password is never typed in commands.
What's inside
Creator
Medhedi Chebil
Frequently Asked Questions
New in Business & Operations
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Business & Operations.