hadley / r4ds

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

Warning message Section 21.3.3 DBI basics #1596

Closed jcornickm closed 10 months ago

jcornickm commented 10 months 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 10 months 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"