Giter Site home page Giter Site logo

ln2sqlmodule's Introduction

ln2sqlmodule

This is an adoption of the awesome ln2sql by Jérémy Ferrero as a python module so that people can easily use it to create some awesome things !

Things added in ln2sqlmodule :

  • API for getting WHERE queries with LIKE and '%'
  • INNER JOIN working correctly with FOREIGN KEY
  • PRIMARY KEY and FOREIGN KEY detection from ALTER STATEMENT
  • Value extraction from natural language

INSTALLATION

  • Download, unzip and place in your project directory
  • import ln2sqlmodule

USAGE

  • ln2sqlmodule.getSql(query, sqlDump[, outputFile]) returns SQL query from natural language query

    outputFile Schema

      Parameters :
      	query      :    query in natural language
      	sqlDump    :    path to sql dump file    
      	outputFile :    path to file to output SQL query in json       
      
      returns : 
      	SQL query string
    
      Example:
      	ln2sqlmodule.getSql("get name of all emp","./emp.sql")
      	-> SELECT name FROM  emp
    
  • ln2sqlmodule.getSql_like(query, sqlDump[, outputFile]) returns SQL query from natural language with LIKE with % in WHERE clause

    outputFile Schema

      Parameters :
      	query      :    query in natural language
      	sqlDump    :    path to sql dump file
      	outputFile :    path to file to output SQL query in json   
      
      returns : 
      	SQL query string with LIKE
    
      Example:
      	ln2sqlmodule.getSql("all data for emp where name is rupinder","./emp.sql")
      	-> SELECT * FROM  emp WHERE name LIKE '%rupinder%'
    
      	ln2sqlmodule.getSql("all data for emp where name is 'abc xyz'","./emp.sql")
      	-> SELECT * FROM  emp WHERE name LIKE '%abc%xyz'
    

outputFile Schema

{
	"select": {
		"column": "",
		"type": ""
	},
	"from": {
		"table": ""
	},
	"join": {
	},
	"where": {
	},
	"group_by": {
	},
	"order_by": {
	}
}

ln2sqlmodule's People

Contributors

rupinder1133 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.