Skip to main content

Convert natural language questions to SQL query

Project description


How many times have you pulled your hair apart writing a SQL query, now use natural language to convert to appropriate SQL and save your precious hair.

Though this can be used as a standalone package, I highly recommend that you use streamlit to play with the model interactively, to run it interactively

streamlit run


To install this repo clone it then run

git clone
cd text2sql/
pip3 install -e . #text2sql


New method of parsing to convert each DB to a graph network, red denotes foreign keys.

Trainer File

Simple trainer file.


Using CoSQL, Spider, Sparc datasets, credit to the authors. There are a couple of things to note, we have in total 178 tables, but only 166 tables in training date and dev set has 20 tables.


Following are the licensing things:

  1. I am releasing my part of code under MIT License
  2. transformers code is under Apache License, Version 2.0

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

text2sql-0.1.1.tar.gz (2.9 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page