srowell
September 1, 2022, 9:32pm
1
When running RMD documents I use the rstudioapi::askForPassword function to push passwords to databases. This works both in interactive mode and when knitting.
However when using qmd, when I hit the "render" button in RStudio 2022.07.1 Build 554
I get the error
Quitting from lines 16-19 (test.qmd)
Error: RStudio not running
I'm not sure how to create a reprex since it is an issue with rendering an RMD, but I get the error just by adding the command rstudioapi::askForPassword("testing") to an R chunk inside the default qmd template that is created when you do file > new quarto document
Is it not possible to use the rstudioapi package when rendering a qmd?
cderv
September 5, 2022, 2:48pm
2
An issue has been opened on Quarto and I some contribution to discussion there
opened 01:22PM - 02 Sep 22 UTC
closed 05:45PM - 14 Sep 22 UTC
bug
upstream
### Bug description
Taken from [Community](https://community.rstudio.com/t/rstu… dioapi-askforpassword-function-in-quarto/146254) (2022-01-01):
When running RMD documents I use the rstudioapi::askForPassword function to push passwords to databases. This works both in interactive mode and when knitting.
However when using qmd, when I hit the "render" button in RStudio 2022.07.1 Build 554
I get the error
Quitting from lines 16-19 (test.qmd)
Error: RStudio not running
I'm not sure how to create a reprex since it is an issue with rendering an RMD, but I get the error just by adding the command rstudioapi::askForPassword("testing") to an R chunk inside the default qmd template that is created when you do file > new quarto document
Is it not possible to use the rstudioapi package when rendering a qmd?
### Checklist
- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://yihui.org/issue/#please-format-your-issue-correctly) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
srowell
September 6, 2022, 7:50pm
3
Thanks for the update; I read the report (and response), I've seen a similar comment that " The R process launch by Quarto won't have access to any of the IDE feature as this not interactive and not running in the IDE." in another request.
Just from a user side; when rendering from within RStudio IDE it does cause a certain pain-point not to be able to use features of the IDE. You noted that you didn't think typing a password when rendering was ideal - but it works in the corporate environment when there is concern with storing passwords.
FYI - I ran across this same issue as reported in 2310 as well - I'll need to shift back to RMD until that bug is fixed anyway - but it has been interesting playing with it interactively.
opened 09:11AM - 06 Sep 22 UTC
closed 04:41PM - 14 Sep 22 UTC
bug
### Discussed in https://github.com/quarto-dev/quarto-cli/discussions/2308
<d… iv type='discussions-op-text'>
<sup>Originally posted by **emmansh** September 5, 2022</sup>
I'm trying to set up a quarto website with some SQL code chunks. Trying to reproduce some DB code from [R4DS book](https://r4ds.hadley.nz/databases.html#in-this-book) fails with quarto website.
<pre>
# index.qmd
```{r}
library(DBI)
library(duckdb)
```
```{r}
con <- DBI::dbConnect(duckdb::duckdb(), dbdir = "duckdb")
dbWriteTable(con, "mpg", ggplot2::mpg)
```
```{sql, connection=con}
SELECT manufacturer, displ, cty
FROM mpg
ORDER BY manufacturer, displ DESC
```
</pre>
Then in terminal
```shell
quarto preview
```
I get the following print:
```
Preparing to preview
[1/1] index.qmd
processing file: index.qmd
|......... | 12%
ordinary text without R code
|.................. | 25%
label: unnamed-chunk-1
|.......................... | 38%
ordinary text without R code
|................................... | 50%
label: unnamed-chunk-2
|............................................ | 62%
ordinary text without R code
|.................................................... | 75%
label: unnamed-chunk-3
|............................................................. | 88%
ordinary text without R code
|......................................................................| 100%
label: unnamed-chunk-4 (with options)
List of 2
$ connection:Formal class 'duckdb_connection' [package "duckdb"] with 5 slots
.. ..@ conn_ref :<externalptr>
.. ..@ driver :Formal class 'duckdb_driver' [package "duckdb"] with 3 slots
.. .. .. ..@ database_ref:<externalptr>
.. .. .. ..@ dbdir : chr "duckdb"
.. .. .. ..@ read_only : logi FALSE
.. ..@ debug : logi FALSE
.. ..@ timezone_out : chr "UTC"
.. ..@ tz_out_convert: chr "with"
$ engine : chr "sql"
Quitting from lines 26-29 (index.qmd)
Error: No method for S4 class:duckdb_connection
Execution halted
Warning messages:
1: Connection is garbage-collected, use dbDisconnect() to avoid this.
2: Database is garbage-collected, use dbDisconnect(con, shutdown=TRUE) or duckdb::duckdb_shutdown(drv) to avoid this.
```
Why can't I use `duckdb()` for establishing a connection and using an SQL code chunk in quarto website? It's worth noting that same code works in regular, non-website, `.rmd` file.</div>
1 Like
system
Closed
September 13, 2022, 7:51pm
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.