Icon

SQL Query Generator

There has been no title set for this workflow's metadata.

This workflow is a data app that generates SQL queries based on the question provided by the user.

It is a simple chatbot data app that connects with the OpenAI GPT-3.5-turbo-16k model. A user generates the system prompt in the String Input Widget. This prompt contains a set of instructions and a placeholder to add the database schema to query from.

This schema is a .sql file containing the DDL commands along with comments that define what each column means. Further comments are added to explain which column joins are possible with other columns. The comments are helpful for LLMs to better understand the database schema. The updated .sql file with comments is included in this workflow group.

The system prompt is merged with the uploaded .sql file. This initializes the chat instance with GPT. Using the "Chat Window" component, the user inputs the statement against which the query has to be generated.

URL: OpenAPI Key https://platform.openai.com/api-keys
URL: HR Schema in Postgres https://gist.github.com/gourab5139014/b0b8e90c66acd5d0e9bcfebbff65d02a

Nodes

Extensions

Links