Skip to contents

compute() materializes all tables in a dm to new (temporary or permanent) tables on the database.

collect() downloads the tables in a dm object as local tibbles.

Usage

# S3 method for dm
compute(x, ...)

# S3 method for dm
collect(x, ..., progress = NA)

Arguments

x

A dm object.

...

Passed on to compute().

progress

Whether to display a progress bar, if NA (the default) hide in non-interactive mode, show in interactive mode. Requires the 'progress' package.

Value

A dm object of the same structure as the input.

Details

Called on a dm object, these methods create a copy of all tables in the dm. Depending on the size of your data this may take a long time.

Examples

financial <- dm_financial_sqlite()

financial %>%
  pull_tbl(districts) %>%
  dbplyr::remote_name()
#> <IDENT> `districts`

# compute() copies the data to new tables:
financial %>%
  compute() %>%
  pull_tbl(districts) %>%
  dbplyr::remote_name()
#> <IDENT> dbplyr_005

# collect() returns a local dm:
financial %>%
  collect() %>%
  pull_tbl(districts) %>%
  class()
#> [1] "tbl_df"     "tbl"        "data.frame"