Skip to content

[051-movie-explorer] update from src_sqlite to tbl #223

@jhk0530

Description

@jhk0530

Hello team, In movie explorer's code

# Set up handles to database tables on app start
db <- src_sqlite("movies.db")
omdb <- tbl(db, "omdb")
tomatoes <- tbl(db, "tomatoes")

The src_sqlite() function was deprecated in {dplyr} 1.0.0, (latest version is 1.1.4)
and it guides to use tbl() function instead as warning message below.

Warning: `src_sqlite()` was deprecated in dplyr 1.0.0.
ℹ Please use `tbl()` directly with a database connection
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.

So how about using DBI::dbConnect and RQLite::SQLite() that suggested in src_sqlite() document?

Example docs

con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
copy_to(con, mtcars)

Final result

# Set up handles to database tables on app start
con <- DBI::dbConnect(RSQLite::SQLite(), "movies.db")
omdb <- dplyr::tbl(con, "omdb")
tomatoes <- dplyr::tbl(con, "tomatoes")

Thanks.

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