sql-studio icon indicating copy to clipboard operation
sql-studio copied to clipboard

Features - Implement Auto-Suggestion - SQL Editor

Open Victor1890 opened this issue 1 year ago • 2 comments

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

image

After

image

Victor1890 avatar Oct 13 '24 22:10 Victor1890

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"]
    }
]

frectonz avatar Oct 14 '24 07:10 frectonz

Exactly

Victor1890 avatar Oct 14 '24 18:10 Victor1890

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.

frectonz avatar Oct 17 '24 12:10 frectonz

Thanks, I'll to work this feature.

Victor1890 avatar Oct 19 '24 18:10 Victor1890

#49

Victor1890 avatar Oct 20 '24 02:10 Victor1890