Skip to main content

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

pip install ln2sqlmodule
import ln2sqlmodule

USAGE

getSql(query, sqlDump[, outputFile])

  • 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

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": {
	}
}

Release files for ln2sqlmodule 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ln2sqlmodule 1.0.2
File Size Uploaded
ln2sqlmodule-1.0.2.tar.gz 10.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ln2sqlmodule 1.0.2
File Interpreter ABI Platform
ln2sqlmodule-1.0.2-py2-none-any.whl Python 2 none any Details

Total release size: 20.3 MB

Release files / ln2sqlmodule-1.0.2.tar.gz

Download URL ln2sqlmodule-1.0.2.tar.gz
Size 10.1 MB
Tags Source
SHA-256 checksum
How to use checksums
2aa19d0d5ba112b6e6c31b33654817d5b7f38727ea856e0dea33d537801ff849
BLAKE2b-256 checksum
How to use checksums
ea493a8628ec82b57c97059cce91a1a9eafa5f2b5275bcecf217a13d6776e5bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.15

Release files / ln2sqlmodule-1.0.2-py2-none-any.whl

Download URL ln2sqlmodule-1.0.2-py2-none-any.whl
Size 10.2 MB
Tags Python 2
SHA-256 checksum
How to use checksums
211b332a00812935057199299838ede6f99e9b7010107ad8e8ae4910bba77185
BLAKE2b-256 checksum
How to use checksums
f61d7ff299efa8fd90f9deea58856eadbbc7ed58249b136f587f6d5fc1994461
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.15

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.4

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page