Hello! I am trying to use SQL chunks within the Quarto document. When I use R Markdown with SQL chunks, I get no error while knitting it. Once I switch the same code from rmd extension to qmd, I get errors in SQL chunks while rendering qmd file. Particularly, I get the following error:
"Error: No method for S4 class:SQLiteConnection Execution halted"
Does anyone know what is happening? Any help is appreciated.
Here is the R Markdown file that knits:
---
title: "SQL in R Markdown"
author: "Tural Sadigov"
date: "2022-09-18"
output: html_document
---
```{r libs}
library(tidyverse)
library(DBI)
library(RSQLite)
library(dbplyr)
```
```{r}
con <- DBI::dbConnect(RSQLite::SQLite(),
dbname = ":memory:")
copy_to(dest = con,
df = mtcars,
name = "mtcars")
dbListTables(con)
```
```{sql, connection=con}
SELECT *
FROM mtcars
```
Here is the Quarto , qmd, file that gives the error .
I have discovered {sql} chunks just by curiosity, if quarto would do fancy formatting any SQL expression. Then it requested a valid connection. I have added one, then it started throw a SQL errors . Ha, have discovered it executes the code (and is doing a fancy formatting as well ).