Learn R Programming

dbplyr (version 2.4.0)

db-io: Database I/O generics

Description

These generics are responsible for getting data into and out of the database. They should be used a last resort - only use them when you can't make a backend work by providing methods for DBI generics, or for dbplyr's SQL generation generics. They tend to be most needed when a backend has special handling of temporary tables.

  • db_copy_to() implements copy_to.src_sql() by calling db_write_table() (which calls DBI::dbWriteTable()) to transfer the data, then optionally adds indexes (via sql_table_index()) and analyses (via sql_table_analyze()).

  • db_compute() implements compute.tbl_sql() by calling sql_query_save() to create the table, then optionally adds indexes (via sql_table_index()) and analyses (via sql_table_analyze()).

  • db_collect() implements collect.tbl_sql() using DBI::dbSendQuery() and DBI::dbFetch().

  • db_table_temporary() is used for databases that have special naming schemes for temporary tables (e.g. SQL server and SAP HANA require temporary tables to start with #)

Usage

db_copy_to(
  con,
  table,
  values,
  ...,
  overwrite = FALSE,
  types = NULL,
  temporary = TRUE,
  unique_indexes = NULL,
  indexes = NULL,
  analyze = TRUE,
  in_transaction = TRUE
)

db_compute( con, table, sql, ..., overwrite = FALSE, temporary = TRUE, unique_indexes = list(), indexes = list(), analyze = TRUE, in_transaction = TRUE )

db_collect(con, sql, n = -1, warn_incomplete = TRUE, ...)

db_table_temporary(con, table, temporary, ...)

Arguments

See Also

Other generic: db-sql, db_connection_describe(), sql_escape_logical()