Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to render cell output using Data Table Renderers #619

Closed
jlewi opened this issue Jun 24, 2024 · 5 comments
Closed

Question: How to render cell output using Data Table Renderers #619

jlewi opened this issue Jun 24, 2024 · 5 comments

Comments

@jlewi
Copy link
Contributor

jlewi commented Jun 24, 2024

Here's a discord thread with a demo of using
Data Table Renderers to render JSON output as a table.

It looks like the steps are

  1. Install the Data Table Renderers Extension
  2. Change the cell output mime/type to be application/json
  3. Change the cell presentation type to be data table renderer

When I click on change cell presentation I don't see the data table renderer option.
Do you know what I'm doing wrong?

datatable_renderers.mp4
@sourishkrout
Copy link
Member

In the Configure foldout for the respective cell, please untick interactive as per https://docs.runme.dev/configuration/cell-level#human-friendly-output.

Interactive here means "attach a tty/terminal." Do you have any suggestions on how we can make this clearer in docs or otherwise?

Btw, you should be able to leave the mimeType empty since Runme has a pretty accurate auto-detection of JSON, CSV, etc now.

@sourishkrout
Copy link
Member

sourishkrout commented Jun 25, 2024

I just checked how mime/media type detection works and realized we could technically offer a button (e.g., next to "Copy") to switch to non-interactive mode if we detect a non-plain-text media type 🤔. We could track this as a feature request. It likely would make it more "obvious" how to leverage other renderers. Thoughts, @jlewi?

@jlewi
Copy link
Contributor Author

jlewi commented Jun 25, 2024

Thank you.
Regarding the docs; I never thought to look at
https://docs.runme.dev/configuration/cell-level#human-friendly-output.

I wound up here
https://marketplace.visualstudio.com/items?itemName=RandomFractalsInc.vscode-data-table
Which didn't mention it.

For the docs it might be helpful to have guide sections that show how to deal with rendering e.g. in this case
"How to work with JSON"
or perhaps even higher level
"How to work with BigQuery"

It looks like you have a bunch of how tos under the guide section but based on the titles none of them jump out to me as relevant to my problem in this case.

@jlewi jlewi closed this as completed Jun 25, 2024
@sourishkrout
Copy link
Member

Thanks for the feedback! We'll take the suggestions for the docs back to the team.

@jlewi
Copy link
Contributor Author

jlewi commented Jun 25, 2024

I haven't been able to reproduce this consistently but in some cases it looks like I observed it being necessary to clear cell outputs and rerun the cell after disabling interactive mode. I think the steps were

  1. Create a cell with bq --format=json...
  2. Execute it
  3. Change cell to disable interactive
  4. Try to change cell; other formats don't show up
  5. Rerun cell
  6. Try to change presentation; other formats don't show up
  7. Clear cell outputs
  8. Rerun the cell
  9. Cell is now displayed correctly

A confounding factor is that it looks like the bq query will sometimes output job stats information to stderr if the job takes a long time. I think this prevents the output from being valid JSON. Redirecting to "2>/dev/null" seems to fix that problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants