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

How to achieve sql column name auto completion?

Open melin opened this issue 3 years ago • 2 comments

example: select na from tb1 a left join tb2 b a.code=b.code。 Enter na, how to get the table name: tb1 and tb2, more complex sql, may contain nesting, how to get the corresponding table name, query field information through the table name.

@mtriff The project does not fully implement the modelDBA sqleditor code complete feature.

melin avatar Aug 23 '22 03:08 melin

That's right, there's a lot of database structure information that modelDBA uses to better provide suggestions. That is outside of the scope of this package. The best you can do with this package is provide the table names and column names during instantiation like so:

const sqlAutocomplete = new SQLAutocomplete(SQLDialect.MYSQL,
                                            ['myDatabaseTableName'], // Optional
                                            ['aColumnName']);        // Optional

However, this package can't narrow down suggestions based on which columns belong to which table.

mtriff avatar Aug 23 '22 14:08 mtriff

However, this package can't narrow down suggestions based on which columns belong to which table.

modeldba editor supports table alias filter column name,are there plans to enhance this feature?

melin avatar Aug 24 '22 01:08 melin