SQL Chat
SQL Chat · GPT 작업
AskYourDatabase
Chat with your databases without writing any SQL code.
POST /api/get-startedCall this API whenever user asks how to use this plugin, it will return a getting started message.POST /api/metaCall this to fetch schema whenever users provide the database uri without asking them what tasks are they going to perform. Get table schemas, also can specify queries from user questions to find most relevant tables. Call this first to help you generate SQL.POST /api/queryNo need for user confirmation. Call /api/meta to fetch related table columns first if you do not know them. Execute SQL query and return results, do not use this for mongoDB, use /api/mongoQuery instead. Do not use this for table schema, use /api/meta insteadPOST /api/mongoQueryExecute mongodb query and return results
원본 API 스키마
{
"openapi": "3.0.1",
"info": {
"title": "AskYourDatabase",
"description": "Chat with your databases without writing any SQL code.",
"version": "v1"
},
"paths": {
"/api/get-started": {
"post": {
"x-openai-isConsequential": false,
"operationId": "getStarted",
"summary": "Call this API whenever user asks how to use this plugin, it will return a getting started message.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"msg": {
"type": "string"
}
}
}
}
}
}
}
}
},
"/api/meta": {
"post": {
"x-openai-isConsequential": false,
"operationId": "getDatabaseMeta",
"summary": "Call this to fetch schema whenever users provide the database uri without asking them what tasks are they going to perform. Get table schemas, also can specify queries from user questions to find most relevant tables. Call this first to help you generate SQL. ",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DatabaseRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DatabaseMeta"
}
}
}
}
}
}
},
"/api/query": {
"post": {
"x-openai-isConsequential": false,
"operationId": "executeSQL",
"summary": "No need for user confirmation. Call /api/meta to fetch related table columns first if you do not know them. Execute SQL query and return results, do not use this for mongoDB, use /api/mongoQuery instead. Do not use this for table schema, use /api/meta instead",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryResponse"
}
}
}
}
}
}
},
"/api/mongoQuery": {
"post": {
"x-openai-isConsequential": false,
"operationId": "executeMongoQuery",
"summary": "Execute mongodb query and return results",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MongoQueryRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryResponse"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"DatabaseRequest": {
"type": "object",
"properties": {
"uri": {
"type": "string"
},
"query": {
"description": "semantic keywords based on user question",
"type": "string"
}
},
"required": [
"uri",
"query"
]
},
"DatabaseMeta": {
"type": "object",
"properties": {
"dbs": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Database"
}
}
}
},
"Database": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"tables": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Table"
}
}
}
},
"Table": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"fields": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Field"
}
}
}
},
"Field": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"QueryRequest": {
"type": "object",
"properties": {
"uri": {
"type": "string"
},
"sql": {
"type": "string"
}
},
"required": [
"uri",
"sql"
]
},
"MongoQueryRequest": {
"type": "object",
"description": "mongodb query language",
"properties": {
"uri": {
"type": "string"
},
"collection": {
"type": "string"
},
"actionType": {
"type": "string",
"description": "aggregate, count, deleteMany, deleteOne, distinct, find, findOne, findOneAndUpdate, insertMany, insertOne, updateMany, updateOne"
},
"query": {
"type": "string",
"description": "stringified json object, for find methods"
},
"filter": {
"type": "string",
"description": "stringified json object, for update, delete methods"
},
"fieldName": {
"type": "string",
"description": "stringified json object, for distinct method"
},
"aggregation": {
"type": "string",
"description": "stringified json array, for aggregate"
},
"projection": {
"type": "string",
"description": "stringified json object"
},
"skip": {
"type": "number"
},
"update": {
"type": "string",
"description": "stringified json object"
},
"options": {
"type": "string",
"description": "stringified json object"
},
"limit": {
"type": "number",
"description": "always use a limit and don't exceed 20 unless user required"
},
"sort": {
"type": "string",
"description": "stringified json object"
},
"document": {
"type": "string",
"description": "stringified json object, for insertOne"
},
"documents": {
"type": "string",
"description": "stringified json array, for insertMany"
}
},
"required": [
"uri",
"collection",
"actionType"
]
},
"QueryResponse": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object"
}
}
}
}
}
},
"servers": [
{
"url": "https://x.askyourdatabase.com"
}
]
}