Agent Wealth HubFree public resources
中文 EN العربية

Back to catalog / Data automation

Turn natural-language analysis into read-only SQL

Provide the schema of a test database, inspect generated SQL, then execute it only on a read-only replica.

Goal

Help analysts explore business data without granting database write access.

Steps

  1. Create the notebook’s synthetic SQLite database and schema summary; expose only required tables/columns. [sql]
  2. Ask Claude for SQL and rationale; parse it in the application and allow only a single SELECT against read-only views. [sql]
  3. Execute on a read-only connection with timeout/row limits and verify result columns match the question before display. [sql]

How to verify

The application rejects writes, multiple statements, unauthorized tables, and invalid SQL; valid SELECT results are reproducible.

Troubleshooting

If columns are wrong, narrow the schema and clarify business fields; do not broaden privileges to bypass failures.

Permissions

Prerequisites

Permissions

Limitations

Model output may contain dangerous SQL; prompts are not a security boundary—enforce both parser checks and DB read-only permissions.

Pinned upstream source

https://github.com/anthropics/anthropic-cookbook/blob/9c1e493ddd2b82df399d2a61b9c806c539e18be6/capabilities/text_to_sql/guide.ipynb

Repository
anthropics/anthropic-cookbook
File path
capabilities/text_to_sql/guide.ipynb
Pinned commit
9c1e493ddd2b82df399d2a61b9c806c539e18be6
Source checked
2026-10-14 · Reviewed against the pinned upstream source

Repository metrics

These values describe the upstream repository, not popularity or likes for an individual skill or playbook.

Stars
Not collected
Forks
Not collected
Observed at
Not collected

No metrics snapshot is available yet.

License: MIT

Main topic

Take a coding Agent change from context to verification

Related resources