
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@dramildodeja/nlp2sql
Advanced tools
Convert natural language into SQL, NoSQL, or SOQL queries using AI and NLP. Generate database queries from text easily.
Convert natural language into SQL, NoSQL, or SOQL queries.
Supports CLI, environment variables, Docker, Redis caching, and multiple query types.
gpt-3.5-turbo (default, free tier), gpt-4Overriding Models:
CLI: nlp2sql --schema "Account(Id, Name, Email)" --apikey "YOUR_OPENAI_KEY" --text "Get all accounts with gmail.com email" --type soql --model gpt-4
Node.js: const { generateQuery, MODELS } = require('nlp2sql'); const result = await generateQuery(schema, apiKey, text, MODELS.gpt4, 'soql');
If no model or type is specified, defaults are
gpt-3.5-turboand query type auto-detected from schema.
gpt-3.5-turbo, gpt-4)npm install -g @dramildodeja/nlp2sql
nlp2sql --schema "users(id,name,email)" \
--apikey "YOUR_OPENAI_KEY" \
--text "Get all users with email ending in gmail.com" \
--model gpt-3.5-turbo \
--type sql
nlp2sql --schema "users(_id,name,email)" \
--apikey "YOUR_OPENAI_KEY" \
--text "Find all users with email ending in gmail.com" \
--model gpt-3.5-turbo \
--type nosql
nlp2sql --schema "Account(Id, Name, Email)" \
--apikey "YOUR_OPENAI_KEY" \
--text "Get all accounts with gmail.com email" \
--model gpt-3.5-turbo \
--type soql
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
| -s, --schema | Database schema details | Yes | N/A |
| -k, --apikey | OpenAI API key (or use env variable OPENAI_API_KEY) | Conditional | N/A |
| -t, --text | Text for query generation | Yes | N/A |
| -m, --model | Model to use | No | gpt-3.5-turbo |
| --type <sql | nosql | soql> | Query type |
Your examples/ folder includes ready-to-run scripts for SQL, NoSQL, and SOQL queries.
Make sure you have set your OpenAI API key in a .env file:
OPENAI_API_KEY=your_openai_api_key_here
DEFAULT_MODEL=gpt-3.5-turbo
node examples/test-sql.js
node examples/test-nosql.js
node examples/test-soql.js
require('dotenv').config(); const { generateQuery, prettyPrint, MODELS } = require('nlp2sql');
const schema = 'Account(Id, Name, Email)'; const text = 'Get all accounts with gmail.com email'; const apiKey = process.env.OPENAI_API_KEY || '<YOUR_OPENAI_KEY>'; const queryType = 'sql'; // optional: 'sql', 'nosql', 'soql'
(async () => { try { const result = await generateQuery(schema, apiKey, text, MODELS.default, queryType); console.log(prettyPrint(result)); } catch (err) { console.error('Error generating query:', err.message); } })();
Note: Only OpenAI provider is supported.
Create a .env file in your project root:
OPENAI_API_KEY=your_openai_api_key_here DEFAULT_MODEL=gpt-3.5-turbo
Copyright (c) 2025 Dramil M Dodeja
This software is free to use, copy, modify, and distribute for any purpose without restriction.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
FAQs
Convert natural language into SQL, NoSQL, or SOQL queries using AI and NLP. Generate database queries from text easily.
We found that @dramildodeja/nlp2sql demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.