microsoft / rat-sql

A relation-aware semantic parsing model from English to SQL
https://arxiv.org/abs/1911.04942
MIT License
407 stars 117 forks source link

How to execute my own queries? #50

Open yaoyiyao-yao opened 3 years ago

yaoyiyao-yao commented 3 years ago

Hello, If I want to test my own queries,what should I do? Thank you very much.

mattr1 commented 3 years ago

The easiest approach is to create a dataset in the same format as the Spider development set (dev.json and associated tables.json, but with your questions and database schemas), and then run preprocessing and eval as you normally would for spider. The path to the dev set (dev.json) is in the .config file -- for simplicity you could just replace the spider dev with your own, but alternatively just extend the config file with one of your own that points to your custom questions instead.

PedroEstevesPT commented 3 years ago

Is there a script available to generate the .jsons given the question in NL and the database file ?

[UPDATE] - In fact, the process is straight forward. In case you want to run RAT-SQL on your own dataset the script needed to generate the .json files for the tables of the DB and for the query are not in this repository but in Spider dataset repo: https://github.com/taoyds/spider. So the easiest thing to do would be:

1 - Generate new_table.json , new.json using Spider script. 2 - Adding the new files in the libsonnet and running RAT-SQL pre-processing step. 3 - Performing inference as you would for a development set.

neg-loss commented 2 years ago

I am able to create new_tables.json but while creating the new_dev.json how do I create the sql component for each query? The sql component is not going to be given manually, right? @Muradean Please guide?

[UPDATE] - I found the solution to above problem, one can follow the instructions given here

It worked for me.