quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.74k stars 305 forks source link

SQL cell (and others?) in jupyter engine and ipython kernel #4227

Open cscheid opened 1 year ago

cscheid commented 1 year ago

It might make sense for us to leverage cell magics to support (eg) a native sql cell in the same way that knitr does it.

Pros:

Cons:

If we continue to increase the ways in which different engines interpret {language} cells, I think it would be a good idea for quarto to be able to explain who runs what cells. I can imagine a TypeScript API that could do so.

eitsupi commented 1 year ago

How about adding a filter to remove cell magic and an option to set the language of the output code block as desired (Same as knitr's lang chunk option), as like https://github.com/CenterOnBudget/quarto-stata-facade?

I imagine the following. This would be versatile (works with any cell magic).

source

```{python}
#| output-language: sql
%%sql postgresql://will:longliveliz@localhost/shakes
select * from character

output

````markdown
```sql
select * from character
cscheid commented 1 year ago

The problem is that this filter needs to happen before jupyter execution, and our current infrastructure has pandoc running after jupyter (and knitr).

With that said, we will be eventually changing quarto to support two pandoc passes (pre-engine and post-engine), but that's on a 1.5-1.6 timeline.