Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/llSourcell/SQL_Database_Optimization
This is the code for "SQL Database Optimization" By Siraj Raval on Youtube
https://github.com/llSourcell/SQL_Database_Optimization
Last synced: 3 months ago
JSON representation
This is the code for "SQL Database Optimization" By Siraj Raval on Youtube
- Host: GitHub
- URL: https://github.com/llSourcell/SQL_Database_Optimization
- Owner: llSourcell
- License: bsd-3-clause
- Created: 2018-10-15T14:23:01.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-18T19:13:39.000Z (about 6 years ago)
- Last Synced: 2024-05-19T23:35:37.321Z (6 months ago)
- Language: Python
- Size: 28.3 KB
- Stars: 60
- Watchers: 6
- Forks: 24
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SQLNet
This is the code for [this](https://youtu.be/Rw3ewEXOKC8) video on Youtube by Siraj Raval. This repo provides an implementation of SQLNet and Seq2SQL neural networks for predicting SQL queries on [WikiSQL dataset](https://github.com/salesforce/WikiSQL). The paper is available at [here](https://arxiv.org/abs/1711.04436).
## Citation
> Xiaojun Xu, Chang Liu, Dawn Song. 2017. SQLNet: Generating Structured Queries from Natural Language Without Reinforcement Learning.
## Bibtex
```
@article{xu2017sqlnet,
title={SQLNet: Generating Structured Queries From Natural Language Without Reinforcement Learning},
author={Xu, Xiaojun and Liu, Chang and Song, Dawn},
journal={arXiv preprint arXiv:1711.04436},
year={2017}
}
```## Installation
The data is in `data.tar.bz2`. Unzip the code by running
```bash
tar -xjvf data.tar.bz2
```The code is written using PyTorch in Python 2.7. Check [here](http://pytorch.org/) to install PyTorch. You can install other dependency by running
```bash
pip install -r requirements.txt
```## Downloading the glove embedding.
Download the pretrained glove embedding from [here](https://github.com/stanfordnlp/GloVe) using
```bash
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:
```bash
python extract_vocab.py
```## Train
The training script is `train.py`. To see the detailed parameters for running:
```bash
python train.py -h
```Some typical usage are listed as below:
Train a SQLNet model with column attention:
```bash
python train.py --ca
```Train a SQLNet model with column attention and trainable embedding (requires pretraining without training embedding, i.e., executing the command above):
```bash
python train.py --ca --train_emb
```Pretrain a [Seq2SQL model](https://arxiv.org/abs/1709.00103) on the re-splitted dataset
```bash
python train.py --baseline --dataset 1
```Train a Seq2SQL model with Reinforcement Learning after pretraining
```bash
python train.py --baseline --dataset 1 --rl
```## 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 SQLNet model with column attention
```bash
python test.py --ca
```Test a trained SQLNet model with column attention and trainable embedding:
```bash
python test.py --ca --train_emb
```Test a trained [Seq2SQL model](https://arxiv.org/abs/1709.00103) withour RL on the re-splitted dataset
```bash
python test.py --baseline --dataset 1
```Test a trained Seq2SQL model with Reinforcement learning
```bash
python test.py --baseline --dataset 1 --rl
```## Credits
Credits for this code go to [xiaojunxu](https://github.com/xiaojunxu/SQLNet). I've merely created a wrapper to get people started.