SQL Generator Pack
★Trustedv1.0.0MIT✔Verified88by AgentNode · published 22 days ago · toolpack
Generate SQL queries from natural language descriptions.
Translates natural language to SQL with schema awareness and query validation.
Quick Start
agentnode install sql-generator-packUsage
From packagefrom 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
Package installs and imports correctly. runtime checks passed.
This package was executed and validated by AgentNode before listing. Install, import, and runtime checks passed.
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
| Parameter | Type | Description |
|---|---|---|
question | str | Natural language description of the desired query |
schema | dict | Table names mapped to column name lists |
dialect | str | "postgresql", "mysql", "sqlite", or "sqlserver" |
query_type | str | "auto", "select", "dml", or "ddl" |
Returns: sql, query_type, tables_referenced, explanation, is_destructive
License
MIT
Version History
Capabilities
Permissions
This package declares the following access levels. Review before installing.
agentnode install sql-generator-packFiles (3)
License
MITStats
Compatibility
Frameworks
Runtime
pythonPython Version
>=3.10Trust & Security
Publisher
AgentNode
@agentnode