Run `{sql}` code cells with ggsql, as for `.sql` files
维护者通常 6 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
调研方向
Start by reproducing the example document with quarto render and confirming that the {sql} cell is dropped before the ggsql kernel sees it. Then trace Quarto's cell-language filtering and its langCommentChars handling in quarto-cli, and compare with ggsql-jupyter's kernel language registration. The design questions (opt-out location, SQL-only default, knitr behavior, both #| and --| prefixes) need maintainer decisions first; the linked Positron work and knitr DBI behavior constrain the answer. Done means {sql} cells render through ggsql under jupyter: ggsql, with a documented opt-out and both option prefixes accepted.
由索引模型根据 Issue 内容生成。
描述
The ggsql extension already runs plain .sql files in the ggsql console. The ggsql.enableSqlFiles setting is on by default, because ggsql is a superset of SQL. I am proposing that ggsql also take over {sql} code cells in Quarto documents, on the same terms.
Current behavior
A {sql} cell contains the same SQL as a .sql file, but ggsql does not run it when you render:
ggsql-jupyterreports its language asggsql. The Jupyter engine in Quarto runs only the cells in the language of the kernel, so in ajupyter: ggsqldocument,{sql}cells won't render.{ggsql}cells in the same document render as usual.- In a document that has only
{sql}cells and nojupyterkey, Quarto tries to select a Python kernel, not ggsql.
Positron is working on running {sql} cells with ggsql in the editor in posit-dev/positron#17401, except in knitr documents. When that change ships, a document can run correctly cell by cell (like with inline output or in the console) but will render with no SQL output.
Reproducible example
---
title: "SQL cells with ggsql"
format: html
jupyter: ggsql
---
```{ggsql}
-- @connect: duckdb://memory
SELECT 1 AS from_ggsql_cell
```
```{sql}
SELECT 2 AS from_sql_cell
```
Render it with quarto render. The {ggsql} cell shows a table while the {sql} cell doesn't execute.
Versions: Quarto 1.11.9, ggsql-jupyter 0.5.2.
Proposal
When a document has jupyter: ggsql, run its {sql} cells in the ggsql kernel together with its {ggsql} cells. The document already opts in to ggsql with that key, so this is similar to the .sql file behavior.
Some questions:
- Where does the change go? Quarto filters cells by language before the kernel gets them, so a change in
ggsql-jupyteralone is not sufficient. The change can go in quarto-cli, or in a Quarto integration that ggsql supplies. - How does a user opt out?
ggsql.enableSqlFilesis an editor setting, andquarto rendercannot read it. An opt-out for render must be in the document or the project, for example in the front matter. - Is it on by default for SQL-only documents too? A document with only
{sql}cells and nojupyterkey has no other kernel to use. ggsql is a good default for that document, but this would be a larger change. - What about knitr documents? knitr runs
{sql}chunks with DBI, on the R connection that each chunk names. These documents have to keep that behavior.
Related: cell option comment characters
quarto-cli has no ggsql entry in langCommentChars, so Quarto removes only #| option lines from {ggsql} cells. ggsql-jupyter does not remove option lines itself so a {ggsql} cell with --| options (the usual prefix for {sql} cells) fails to render with "Parse error: Parse tree contains errors". If {sql} cells run in ggsql, both prefixes must work in both cell types.
cc @samclark2015
- 主要语言
- Rust
- 星标
- 573
- 派生
- 32
- 平均合并
- 8 天 23 小时
- 30 天内合并 PR
- 5
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
posit-dev/ggsql 的其他 Issue
-
Missing `linewidth` and `linetype` aesthetics on histogram and bar layers可能已有人在做 @teunbrand 于 30 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 61/100
维护者通常 6 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 6 天内回复
-
writer
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 6 天内回复
-
plot building
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 6 天内回复
-
Mention DuckDB extension可能已有人在做 @Anant-mishra1729 于 152 天前认领。 未关闭documentation integration
难度 1/5 1-3 小时 新手友好度 76/100
维护者通常 6 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
nowledge-co/hawdb#1995 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
swc-project/swc-next-issues#984 ·
-
难度 1/5 1 小时以内 新手友好度 61/100
linuxmint/mint-y-icons#575 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
autofixer: follow-up
难度 2/5 1-3 小时 新手友好度 78/100
tursodatabase/turso#12531 ·
维护者通常 1 天内回复