SQL Generator Pack

Trustedv1.0.0MITVerified88

by AgentNode · published 22 days ago · toolpack

Generate SQL queries from natural language descriptions.

Translates natural language to SQL with schema awareness and query validation.

langchaincrewaigeneric

Quick Start

bash
agentnode install sql-generator-pack

Usage

From package
python
from sql_generator_pack.tool import run

result = run(
    question="Show me the top 10 customers by total order value this quarter",
    schema={
        "customers": ["id", "name", "email", "created_at"],
        "orders": ["id", "customer_id", "total_amount", "status", "created_at"]
    },
    dialect="postgresql"
)

print(result["sql"])
# SELECT c.name, c.email, SUM(o.total_amount) AS total_value
# FROM customers c
# JOIN orders o ON c.id = o.customer_id
# WHERE o.created_at >= date_trunc('quarter', CURRENT_DATE)
#   AND o.status = 'completed'
# GROUP BY c.id, c.name, c.email
# ORDER BY total_value DESC
# LIMIT 10;

print(f"Tables used: {result['tables_referenced']}")
print(f"Query type: {result['query_type']}")

Verification

high confidence88/100✔ Verified
smokeReturned valid result
+25/25
testsAuto-generated tests only
+8/15
importAll tools imported successfully
+15/15
installInstalled in 1.6s
+15/15
contractAll contract checks passed
+10/10
warningsNo warnings
0/0
determinismOutput consistency check
+5/5
reliability3/3 runs passed
+10/10

Package installs and imports correctly. runtime checks passed.

install1.6s
import129ms
smoke126ms
tests902ms

This package was executed and validated by AgentNode before listing. Install, import, and runtime checks passed.

Python 3.12.3ffmpegpopplertesseractuv

Last verified 18d ago· Runner v2.0.0

Use this when you need to...

  • Convert plain English questions into SELECT queries for analytics
  • Generate complex JOIN queries from schema descriptions
  • Build parameterized INSERT and UPDATE statements from natural language
  • Translate business KPI definitions into aggregate SQL queries
  • Generate database migration DDL from schema change descriptions

README

SQL Generator Pack

Generate SQL queries from natural language descriptions. Translates plain English into correct, optimized SQL with full schema awareness. Supports PostgreSQL, MySQL, SQLite, and SQL Server dialects.

Quick Start

agentnode install sql-generator-pack
from sql_generator_pack.tool import run

result = run(
    question="Count active users per month",
    schema={"users": ["id", "email", "is_active", "created_at"]},
    dialect="postgresql"
)
print(result["sql"])

Usage

Analytics Queries

result = run(
    question="What is the average order value by product category for the last 30 days?",
    schema={
        "orders": ["id", "total", "created_at"],
        "order_items": ["order_id", "product_id", "quantity", "price"],
        "products": ["id", "name", "category"]
    },
    dialect="postgresql"
)

Data Modification

result = run(
    question="Deactivate all users who haven't logged in since January 2026",
    schema={"users": ["id", "is_active", "last_login_at"]},
    dialect="mysql",
    query_type="dml"
)

Schema Migrations

result = run(
    question="Create a tags table with a many-to-many relationship to posts",
    schema={"posts": ["id", "title", "body", "author_id"]},
    dialect="postgresql",
    query_type="ddl"
)

API Reference

ParameterTypeDescription
questionstrNatural language description of the desired query
schemadictTable names mapped to column name lists
dialectstr"postgresql", "mysql", "sqlite", or "sqlserver"
query_typestr"auto", "select", "dml", or "ddl"

Returns: sql, query_type, tables_referenced, explanation, is_destructive

License

MIT

Version History

Capabilities

sql_generationgenerate_sqltool

Permissions

This package declares the following access levels. Review before installing.

Networknone
Filesystemnone
Code Executionnone
Data Accessinput_only
User Approvalonce
bash
agentnode install sql-generator-pack

Files (3)

License

MIT

Stats

Downloads0
Installs0
Versionv1.0.0
Published3/16/2026
Channelstable
Typetoolpack
Entrypointsql_generator_pack.tool

Compatibility

Frameworks

langchaincrewaigeneric

Runtime

python

Python Version

>=3.10

Trust & Security

PublisherTrusted
SignatureNone
ProvenanceNone
Security Issues0

Publisher

A

AgentNode

@agentnode