text-to-SQL translation in our serverless Postgres database

We used code-davinci-002 to add text-to-SQL translation to bit.io. You can read about it here: AI-Powered Text-to-SQL Translation on bit.io | bit.io. It’s integrated with our SQL editor. Instead of writing SQL, you can put #!translate:text on the first line and a natural language query on the second.

It works well for simple queries but there’s definitely still work to be done for complex queries, especially across multiple tables. A lot of our work has been around figuring out the optimal amount of database schema information to include. Schema names, table names, column names, and column types typically give the model plenty to work with, but sometimes data examples are needed too.