vscode-dbt-power-user icon indicating copy to clipboard operation
vscode-dbt-power-user copied to clipboard

Expand `SELECT *` into explicit list of columns

Open bdtoole opened this issue 1 year ago • 1 comments

Describe the feature

It would be great to be able to type expand out any SELECT * statements to be a select statements with the columns explicitly listed. Preferably, you could also specify if you wanted leading or trailing commas (perhaps via a configuration setting). The ultimate goal would be to be able to quickly replace

SELECT *
  FROM table

with something similar to

SELECT column_1
     , column_2
     , column_3
     ...
     , column_n
  FROM table

or

SELECT column_1,
       column_2,
       column_3,
     ...
       column_n
  FROM table

I realize the formatting and alignment nature might be tricky, so even if it was something like this, it would be a win, given how easy it is to select multiple lines and tab/space over the indentation.

SELECT
column_1
,column_2
,column_3
...
,column_n
  FROM table

Describe alternatives you've considered

Functionality like this exists in multiple IDEs already, such as Deep Channel and Y42.

Who will benefit?

Anyone that wants to easily replace * with a list of columns.

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

bdtoole avatar Jun 18 '24 19:06 bdtoole