Create INSERT statement based on imported csv or json#435
Create INSERT statement based on imported csv or json#435julesyan merged 8 commits intocodefori:mainfrom
Conversation
|
Looking at the code is aok, but trying the function is better. |
worksofliam
left a comment
There was a problem hiding this comment.
I think it might be nice to have a right click or an editor button (similar to the run button) for this new command.
|
Since we can't tell if the first column is headers without asking (which we could do if we want), i would say add it to the documentation for csv files. Otherwise we will have to put in dummy columns |
|
If we could detect that the 1st row wasn't simple names, we could generate an INSERT with VALUES statement that simply avoided the column names syntax part. That piece is optional but would infer that the spreadsheet was generated by a SELECT * FROM xyz type of query. |
|
@forstie based on our discussion i now prompt the user if the csv has headers or not, it will generate based on that answer |
…ype is extension is not expected
|
vscode-db2i-1.14.0.vsix.zip |
|
Allowed column names to contain spaces |
forstie
left a comment
There was a problem hiding this comment.
Thanks for the changes.
Everything is looking great now.
SanjulaGanepola
left a comment
There was a problem hiding this comment.
I noticed an issue when importing from JSON data (also reproducible with CSV too) when the data has quotes:
You can reproduce this by importing the generated data from running:
json: select * from sample.employee;You can compare with what the expected result should be using:
sql: select * from sample.employee;
SanjulaGanepola
left a comment
There was a problem hiding this comment.
One minor comment, everything else looks good
SanjulaGanepola
left a comment
There was a problem hiding this comment.
Looks good! Nice work


The command is "Generate Insert from File". Tested with the attached files, including with blanks. Will open a new file with the newly generated insert statement.
Closes issue #169
export.csv
export.json