editsql icon indicating copy to clipboard operation
editsql copied to clipboard

getting actual values in predicted SQL queries

Open trangel opened this issue 4 years ago • 2 comments

Hello, I find that all the values in the input questions are replaced by 1 in the SQL query.

For example, if my input is (these examples are just illustrative, not real):

"Get the top 10 samples in column_x" This top 10 query is translated to "SELECT column_x FROM table ORDER BY column_x DESC LIMIT 1" So it replaced top 10 by top 1

Also in conditions: "List a column X where column Y < 0.1" Is translated to "SELECT column_x FROM table WHERE column_y < 1" Again 0.1 is replaced by 1

Do you have a mechanism to fix this?

trangel avatar Feb 24 '21 23:02 trangel

yes getting the same issue it is replacing value by 1 and _EOS by whitespace

select AirportCode, AirportName from airports where City = 1 here city value is 1 as it is hardcoded in code to replace all values with 1

her is the code from postprocessing.py def postprocess_one(pred_sql, schema): pred_sql = pred_sql.replace('group_by', 'group by').replace('order_by', 'order by').replace('limit_value', 'limit 1').replace('_EOS', '').replace(' value ',' 1 ').replace('distinct', '').strip(',').strip() if pred_sql.endswith('value'): pred_sql = pred_sql[:-len('value')] + '1'

mofahad avatar May 23 '22 13:05 mofahad

this out is received in output_temp.txt, is there a way to get correct SQL queries

mofahad avatar May 23 '22 13:05 mofahad