{"slug": "show-hn-queryforge-natural-language-to-validated-database-queries", "title": "Show HN: QueryForge – Natural language to validated database queries", "summary": "QueryForge AI released QueryForge, a tool that converts natural-language requests into parameterized database queries while keeping access rules and validation in the application rather than the LLM. QueryForge validates each request against a JSON config file the application owns and applies the caller's scope before any SQL exists, binding values as parameters instead of concatenating them into the query string. The tool is available via `go get github.com/awsaman-ai/queryforge`, `pip install queryforge-ai`, and a Maven dependency, and requires a config file plus a model API key with no server or database connection.", "body_md": "QueryForge AI turns natural language into validated and parameterized database queries without giving an LLM direct control over your database.\n\nOne request, checked against the configuration your application owns, with your access scope applied before any SQL exists.\n\n“Show cancelled orders over $200 from the last 30 days, newest first.”\n\n```\nSELECT status, created_at, amount, customer_name\nFROM orders\nWHERE (subscription_id = $1 AND user_id = $2\n       AND status = $3 AND amount > $4\n       AND created_at >= $5)\nORDER BY created_at DESC\nLIMIT 50\n[\"SUB-42\", 9, \"CANCELLED\", 200, <now − 30 days>]\n```\n\nIllustrative output for an orders config. Values are bound as parameters, never concatenated into the query string.\n\nA user asks: *“Show me customers from India who haven’t ordered in 6 months.”* A basic AI integration may turn that request directly into a database query. That can create serious problems.\n\nAI is good at understanding language. It should not be responsible for enforcing your application’s rules.\n\nThe AI understands the request. QueryForge validates it against your rules, applies access controls, and generates the database query.\n\nYour AI can understand the user.\n\nYour application stays in control.\n\n{{ f.body }}\n\nYour users shouldn’t need SQL, MongoDB or Elasticsearch, or a page full of filters, to find what they need.\n\nIllustrative mock-up. The page keeps one box; QueryForge turns the sentence into the same validated filters the form used to collect.\n\nA config file tells QueryForge how your data may be used. Build it in the browser, field by field, or import a MySQL or Elasticsearch schema to start from what you already have, then download the JSON.\n\nYour application should not need a different AI integration for every database. QueryForge uses the same validated query plan and generates the format your backend needs.\n\nAccess rules belong to your application — not the AI. Your application already knows:\n\nQueryForge keeps these rules separate from the user’s natural-language request.\n\nSecure by design. Controlled by your application.\n\n```\nres, err := engine.Translate(ctx, \"delivered orders over 500 dollars\", \"sql\", qf.Scope{\n    \"subscriptionId\": session.SubscriptionID,\n    \"userId\":         session.UserID,\n    \"enterpriseId\":   session.EnterpriseIDs,\n})\nWHERE (enterprise_id IN ($1, $2) AND subscription_id = $3\n       AND user_id = $4 AND status = $5 AND amount > $6)\n-- args: [\"E-1\", \"E-2\", \"SUB-42\", 9, \"DELIVERED\", 500]\n```\n\nA production AI system should not always try to answer. When a request is invalid or unsafe, QueryForge rejects it.\n\n{{ r.why }}\n\nA safe AI system knows when not to answer.\n\nYou need a config file ([build one in your browser](config-builder.html)) and a model API key in your environment. No server, no database connection.\n\n```\ngo get github.com/awsaman-ai/queryforge\npip install queryforge-ai\n```\n\nMaven dependency io.github.awsaman-ai:queryforge plus a platform classifier. [Exact snippet in the README →](https://github.com/awsaman-ai/queryforge#install)\n\n```\ncfg, _ := qf.LoadConfig(\"orders.config.json\")\nengine := qf.New(cfg)\n\nres, _ := engine.Translate(ctx,\n    \"cancelled orders over 200 dollars\", \"sql\", nil)\n\nfmt.Println(res.Query.SQL)\n// SELECT … WHERE (status = $1 AND amount > $2) …\nfmt.Println(res.Query.Args)  // [CANCELLED 200]\npython\nfrom queryforge import QueryForge\n\nqf = QueryForge.postgres(\"orders.config.json\")\npending = qf.query(\"cancelled orders over $200\")\nprint(pending.to_sql(), pending.to_args())\n```\n\nYour users already know what they want.\n\nThey shouldn’t need to learn SQL to use your application. Let them ask naturally. Give your application a controlled way to understand them.\n\nAsk naturally. Control what matters.", "url": "https://wpnews.pro/news/show-hn-queryforge-natural-language-to-validated-database-queries", "canonical_source": "https://queryforge-service.amtry.in/", "published_at": "2026-10-26 09:01:10+00:00", "updated_at": "2026-10-26 09:14:07.305703+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "large-language-models", "ai-agents"], "entities": ["QueryForge AI", "QueryForge", "GitHub", "MySQL", "Elasticsearch", "PostgreSQL"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-queryforge-natural-language-to-validated-database-queries", "markdown": "https://wpnews.pro/news/show-hn-queryforge-natural-language-to-validated-database-queries.md", "text": "https://wpnews.pro/news/show-hn-queryforge-natural-language-to-validated-database-queries.txt", "jsonld": "https://wpnews.pro/news/show-hn-queryforge-natural-language-to-validated-database-queries.jsonld"}}