# Create DBI connector
cnt <- ConnectorDBI$new(RSQLite::SQLite(), ":memory:")
cnt
# You can do the same thing using wrapper function connector_dbi()
cnt <- connector_dbi(RSQLite::SQLite(), ":memory:")
cnt
# Write to the database
cnt$write_cnt(iris, "iris")
# Read from the database
cnt$read_cnt("iris") |>
head()
# List available tables
cnt$list_content_cnt()
# Use the connector to run a query
cnt$conn
cnt$conn |>
DBI::dbGetQuery("SELECT * FROM iris limit 5")
# Use dplyr verbs and collect data
cnt$tbl_cnt("iris") |>
dplyr::filter(Sepal.Length > 7) |>
dplyr::collect()
# Disconnect from the database
cnt$disconnect_cnt()
Run the code above in your browser using DataLab