sql-studio
sql-studio copied to clipboard
Features - Implement Auto-Suggestion - SQL Editor
Request for Endpoint to Provide Table and Column Names for Autosuggestion
Body
Hi @frectonz,
I have a few days to implement autosuggestion to the text editor. Currently, I am working on the keyword's functionality like SELECT, LEFT JOIN, WHERE, etc. but I want to add tables and column names and I need one endpoint to give me that info.
Before
After
Thanks for working on this, that sounds like a good idea. What should the endpoint look like?
Maybe something like this
GET /autocomplete
[
{
table_name: "test".
columns: ["id", "name"]
}
]
Exactly
I've completed the implementation of the autocomplete route and made some structural changes:
GET /autocomplete
{
tables: [
{
table_name: "test",
columns: ["id", "name"]
}
]
}
To simplify integration, I added a fetcher with a zod schema in the api.ts file. Additionally, I've included a section that fetches the /autocomplete route using react-query in the query.lazy.tsx file. You can check that out in this commit.
Thanks, I'll to work this feature.
#49