File size: 3,534 Bytes
b296ad4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""Semantic recipes. Placeholders are identifiers/values, never teacher-written SQL."""

RECIPES = {
    'all': 'Show all rows from {table}.',
    'project': 'Show only {column} from {table}.',
    'eq': 'Show all rows from {table} where {category} equals {value}.',
    'project_eq': 'Show {column} from {table} where {category} is {value}.',
    'gt': 'Show rows from {table} with {numeric} greater than {number}.',
    'lt': 'Show rows from {table} with {numeric} less than {number}.',
    'gte': 'Show rows from {table} with {numeric} at least {number}.',
    'lte': 'Show rows from {table} with {numeric} at most {number}.',
    'between': 'Show rows from {table} with {numeric} between {number} and {upper}, inclusive.',
    'and': 'Show rows from {table} where {category} is {value} and {numeric} exceeds {number}.',
    'or': 'Show rows from {table} where {category} is either {value} or {other}.',
    'null': 'Show rows from {table} where {column} is null.',
    'not_null': 'Show rows from {table} where {column} is not null.',
    'count': 'How many rows are in {table}?',
    'count_eq': 'Count rows in {table} where {category} is {value}.',
    'sum': 'Calculate the total {numeric} in {table}.',
    'avg': 'Calculate the average {numeric} in {table}.',
    'max': 'What is the maximum {numeric} in {table}?',
    'min': 'What is the minimum {numeric} in {table}?',
    'distinct': 'List distinct values of {category} in {table}.',
    'sort_desc': 'Show all rows from {table} ordered by {numeric} from highest to lowest.',
    'sort_asc': 'Show all rows from {table} ordered by {numeric} from lowest to highest.',
    'top': 'Show the top {limit} rows from {table} by {numeric}, highest first.',
    'bottom': 'Show the bottom {limit} rows from {table} by {numeric}, lowest first.',
    'group_count': 'Count rows for each {category} in {table}.',
    'group_sum': 'Show total {numeric} for each {category} in {table}.',
    'having': 'Show {category} groups in {table} with more than {number} rows and their counts.',
    'date_after': 'Show rows in {table} with {date_column} on or after {date}.',
    'year': 'Show rows in {table} where the year of {date_column} is {year}.',
    'month': 'Show rows in {table} where the month of {date_column} is {month}.',
    'contains': 'Show rows in {table} whose {column} contains the literal text {value}, case-insensitively.',
    'join': 'Show {table}.{column} and {parent}.{label} by joining {table}.{foreign} to {parent}.id.',
    'join_filter': 'Show {table}.{column} for rows joined by {table}.{foreign} to {parent}.id where {parent}.{label} equals {value}.',
    'list_tables': 'List the tables in this database.',
    'describe': 'Show the columns and types of table {table}.',
    'missing_schema': 'I have not provided a database schema. Find the available tables before writing SQL for {table}.',
    'sql_error': 'The last query failed because a column was unknown. Inspect the schema of {table} before trying again.',
    'ambiguous': 'Show the best records in {table}.',
    'missing_value': 'Filter {table} by {category}, but I have not specified a value.',
    'write': 'Delete every row from {table}.',
    'weather': 'Get the weather in {city} using {unit}.',
    'search': 'Search the documentation for {query}.',
    'read_file': 'Read the file at {path}.',
    'ticket': 'Look up support ticket {ticket_id}.',
    'final': 'The database tool returned {count} rows. Tell me how many rows it returned.',
}

LANGUAGES = ['en', 'noisy_en', 'hi', 'hinglish']