Skip to content

pyseany/NL2SQL

 
 

Repository files navigation

Natural Language to SQL

This repo provides an implementation of our neural networks for predicting SQL queries on WikiSQL dataset. Our paper is available at here.

Citation

Tong Guo, Huilin Gao. 2018. Bidirectional Attention for SQL Generation.

Bibtex

@article{guo2018bidirectional,
  title={Bidirectional Attention for SQL Generation},
  author={Guo, Tong and Gao, Huilin},
  journal={arXiv preprint arXiv:1801.00076},
  year={2018}
}

Installation

The data is in data.tar.bz2. Unzip the code by running

tar -xjvf data.tar.bz2

The code is written using PyTorch in Python 2.7. Check here to install PyTorch. You can install other dependency by running

pip install -r requirements.txt

Downloading the glove embedding.

Download the pretrained glove embedding from here using

bash download_glove.sh

Extract the glove embedding for training.

Run the following command to process the pretrained glove embedding for training the word embedding:

python extract_vocab.py

Train

The training script is train.py. To see the detailed parameters for running:

python train.py -h

Some typical usage are listed as below:

Train a model with bi-attention:

python train.py --ca

Train a model with column attention and trainable embedding (requires pretraining without training embedding, i.e., executing the command above):

python train.py --ca --train_emb

Test

The script for evaluation on the dev split and test split. The parameters for evaluation is roughly the same as the one used for training. For example, the commands for evaluating the models from above commands are:

Test a trained model with column attention

python test.py --ca

Test a trained model with column attention and trainable embedding:

python test.py --ca --train_emb

Reference

https://github.com/xiaojunxu/SQLNet

About

NL2SQL with reading comprehension tech

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.9%
  • Shell 0.1%