The SQL Generation API allows you to manage SQL queries generated from natural language prompts or predefined SQL queries. This API provides endpoints for creating, retrieving, updating, and executing SQL generations.
Endpoint:/api/v1/sql-generationsMethod:GETDescription: Retrieves a list of all SQL generations.
Response:
3. Retrieve a Specific SQL Generation
Endpoint:/api/v1/sql-generations/{sql_generation_id}Method:GETDescription: Retrieves the details of a specific SQL generation identified by sql_generation_id.
Description: Updates the details of an existing SQL generation identified by sql_generation_id.
Response:
5. Execute SQL Query
Endpoint:/api/v1/sql-generations/{sql_generation_id}/executeMethod:GETDescription: Executes the SQL query associated with the specified SQL generation.
Response:
6. Execute SQL Query and Store to CSV
Endpoint:/api/v1/sql-generations/{sql_generation_id}/store-executeMethod:GETDescription: Executes the SQL query associated with the specified SQL generation and store the result as csv file.
Response:
Example Usage
Creating a SQL Generation
To create a new SQL generation, send a POST request to /api/v1/sql-generations:
Request:
Response:
Retrieving All SQL Generations
To retrieve a list of all SQL generations, send a GET request to /api/v1/sql-generations:
Request:
Response:
Retrieving a Specific SQL Generation
To retrieve a specific SQL generation, send a GET request to /api/v1/sql-generations/{sql_generation_id}:
Request:
Response:
Updating a SQL Generation
To update a SQL generation, send a PUT request to /api/v1/sql-generations/{sql_generation_id}:
Request:
Response:
Executing a SQL Query
To execute the SQL query associated with a specific SQL generation, send a GET request to /api/v1/sql-generations/{sql_generation_id}/execute:
Request:
Response:
Executing a SQL Query and Store Into CSV
To execute the SQL query associated with a specific SQL generation and store into csv, send a GET request to /api/v1/sql-generations/{sql_generation_id}/store-execute:
Request:
Response:
This guide provides a comprehensive overview of how to use the SQL Generation API to handle SQL queries and their results effectively.