Open AJTonyKane opened 1 year ago
Ah, interesting. Thanks for the detail here. I suspect the original order is lost when drivers return results as a column keyed JS object. To fix, we'd need to tweak the driver abstraction a bit, specifically the Row
type would need to use a type that preserves column order https://github.com/cmoog/vscode-sql-notebook/blob/9602a251cf9d8431b21021c38edfda07475797fe/src/driver.ts#L27.
Certainly not a big deal...Just chalk the following up to an interesting case I thought you'd want to know about, where the field display order in notebook cell output deviates from the field order specified in an, admittedly non-typical, (MySQL) SELECT statement. For how I use your great extension, please know this does not amount to a hill of beans, but it came up while demonstrating a technique to create a "pivot table" via CASE statement this afternoon and figured you'd find it interesting, regardless. Best wishes, Tony
PS: My work-around for the subsequent demo was just changing field names from "2018", "2019", ... to "y2018", "y2019", ...