cmoog / vscode-sql-notebook

Open SQL files as VSCode Notebooks.
https://marketplace.visualstudio.com/items?itemName=cmoog.sqlnotebook
MIT License
123 stars 16 forks source link

Add support for Data Table rendering #10

Closed shah closed 9 months ago

shah commented 2 years ago

@cmoog it would be great to add support for Data Table renderer. Your extension is great as it is but could be enhanced with Data Table.

cmoog commented 2 years ago

Oh nice find, that would certainly be an improvement over our current table rendering.

miguel-vivanco commented 2 years ago

@cmoog it is a very usefull extension, It is possible to dissable the autowrap the values?, beacause the row height increase a lot for fields with long string value.

cmoog commented 2 years ago

@miguel-vivanco I do agree that the autowrap behavior is frustrating at the moment. Rather than exposing configurations for each aesthetic deficiency individually, I'd rather solve the table rendering problem holistically with something akin to the Data Table approach.

RandomFractals commented 1 year ago

@shah thanks for mentioning my data table renderers.

@cmoog I really like your SQL notebook extension. It's probably the simplest implementation I've seen to run SQL queries in vscode notebooks.

My data table renderers attempt to parse CSV, JSON and GeoJSON data outputs based on the mime type as defined in this package.json: https://github.com/RandomFractals/vscode-data-table/blob/main/package.json#L87

...
  "notebookRenderer": [
      {
        "id": "vscode-data-table",
        "entrypoint": "./out/renderer/dataTable.js",
        "displayName": "Data Table",
        "mimeTypes": [
          "application/json",
          "application/geo+json",
          "application/octet-stream",
          "application/vnd.code.notebook.stdout",
          "application/xml",
          "text/csv",
          "text/plain",
          "text/x-json",
          "text/xml"
        ]
      },

So, if you output JSON or CSV data for the query results instead of using markdown tables with text/markdown mime type, your notebooks will display simple html data tables, data summary, or use flat data viewer depending on the Change Presentation selection for the cell.

You can also define a dependency on my RandomFractalsInc.vscode-data-table renderers extension in your extension package.json to ensure your SQL Notebook users can use or select them for rendering SQL Query restuls. In fact, Databricks extension does this and uses my data table renderers for their notebook cell outputs: https://github.com/paiqo/Databricks-VSCode#notebook-kernel