hadley / r4ds

R for data science: a book
http://r4ds.hadley.nz
Other
4.59k stars 4.22k forks source link

Warning message Section 21.3.3 DBI basics #1596

Closed jcornickm closed 1 year ago

jcornickm commented 1 year ago

The command

dbListTables(con)

Generates the following warning:

Database is garbage-collected, use dbDisconnect(con, shutdown=TRUE) or duckdb::duckdb_shutdown(drv) to avoid this.

I have no idea that this means, but I thought you should be aware of it. The following command, piping con into a tibble works just fine

mine-cetinkaya-rundel commented 1 year ago

Thanks for the feedback! Interesting, the chapter code runs continuously and we aren't seeing the message at https://r4ds.hadley.nz/databases#dbi-basics, and I'm unable to reproduce it locally with DBI 1.1.3:

con <- DBI::dbConnect(duckdb::duckdb(), dbdir = "duckdb")
dbListTables(con)
# [1] "diamonds" "mpg"