Skip to content

Move knitr SQL Engine into DBI? #321

@rnorberg

Description

@rnorberg

I think the three most commonly used R Markdown chunk engines are R, python, and SQL. I noticed that knitr has a rudimentary python engine, but the reticulate package contains its own, much more complex python engine. In this issue in the knitr repo, someone's asking about passing passing parameters in a SQL chunk and @yihui basically says to ask @javierluraschi because he wrote the SQL engine. I think it makes sense to move the SQL engine into a repo that's all about executing SQL, or maybe to create a second, more sophisticated SQL engine for R Markdown in this repo.

Some ideas for an enhanced SQL engine:

  • A way to pass additional arguments such as immediate, to dbGetQuery/dbExecute via chunk options
  • Allow multiple, semicolon separated, SQL statements in a single chunk
  • Better guessing about whether to execute a query with dbExecute or dbGetQuery (see here)
  • When a query is executed with dbExecute(), emit a message() about the number of affected rows (potentially helpful to the author, easily hidden from output with the message = FALSE chunk option)
  • Parse comments out of SQL code using sqlCommentSpec instead of regex for /* ... */ and/or -- ...
  • A vignette all about SQL chunks

What do you think about adding a knitr SQL engine to the DBI package? I'd be willing to take a shot at a first draft.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions