sql-ai-query-generator

1.0.4 • Public • Published

sql-ai-query-generator

package-json


dt dy dm dw

This is a node package that you can use to generate SQL queries by providing inputs in simple English.

It uses OpenAI to generate SQL queries.

Installation

npm install sql-ai-query-generator

This package supports both CommonJS and ES Module.

You can import in the ES Module via:

import createSQLQuery from 'sql-ai-query-generator';

You can import in CommonJS Module via:

const { createSQLQuery } = require("sql-ai-query-generator");

Usage

const { createSQLQuery } = require("sql-ai-query-generator");

const main = async () => {
  const query = await createSQLQuery(API_KEY, ENGINE, QUERY);
};

main();

CreateSQLQuery Function Arguments

  • API_KEY : string, required:true
  • ENGINE : string, required:true, options:gpt-3.5-turbo, gpt-4
  • QUERY : string, required:true

Additional Resources

Example

You can interact with the example in a few different ways:

  1. Check the live Demo.Click here.
  2. Hit the live API using this package with Postman. Use the below details.
  • Method:POST
  • Endpoint:https://sql-query-generator-backend.onrender.com/query
  • Body: {"QUERY": "Create user table with firstname, lastname, DOB, highest education"}

Package Sidebar

Install

npm i sql-ai-query-generator

Weekly Downloads

32

Version

1.0.4

License

MIT

Unpacked Size

13.2 kB

Total Files

19

Last publish

Collaborators

  • vatan