remote_name()
gives the unescaped name of the remote table, or NULL
if it
is a query (created by sql()
) or already escape (created by ident_q()
).
remote_table()
gives the remote table or the query.
remote_query()
gives the text of the query, and remote_query_plan()
the query plan (as computed by the remote database). remote_src()
and
remote_con()
give the dplyr source and DBI connection respectively.
Usage
remote_name(x, null_if_local = TRUE)
remote_table(x, null_if_local = TRUE)
remote_src(x)
remote_con(x)
remote_query(x, cte = FALSE, sql_options = NULL)
remote_query_plan(x, ...)
Arguments
- x
Remote table, currently must be a
tbl_sql
.- null_if_local
Return
NULL
if the remote table is created viatbl_lazy()
orlazy_frame()
?- cte
- sql_options
SQL rendering options generated by
sql_options()
.- ...
Additional arguments passed on to methods.
Value
A string, or NULL
if not a remote table, or not applicable.
For example, computed queries do not have a "name".
Examples
mf <- memdb_frame(x = 1:5, y = 5:1, .name = "blorp")
remote_name(mf)
#> [1] "blorp"
remote_src(mf)
#> src: sqlite 3.50.3 [:memory:]
#> tbls: blorp, dbplyr_00si8liN6h, dbplyr_1N7gYBNlcp, dbplyr_258RgjzX6J,
#> dbplyr_3TKpjGw3nP, dbplyr_71neMYlWKq, dbplyr_74y8jQEZ1U,
#> dbplyr_7gFZ2RIqws, dbplyr_9IdGwG0v58, dbplyr_AbgKY9eIba,
#> dbplyr_BVkzIbwPcL, dbplyr_EmJho1LAQi, dbplyr_FwkzgfuPO1,
#> dbplyr_GrnDDOhsrA, dbplyr_JacgWfAlMk, dbplyr_P8gLIJILJj,
#> dbplyr_aByGT89T45, dbplyr_bOGqaBG4XI, dbplyr_crUoBF7QxM,
#> dbplyr_fLBw8zKN1y, dbplyr_lKLUUEdLie, dbplyr_lRwSZtds9u,
#> dbplyr_rKPRds3Z4q, df, dplyr::band_instruments, dplyr::band_members,
#> mtcars, sqlite_stat1, sqlite_stat4, squirrels
remote_con(mf)
#> <SQLiteConnection>
#> Path: :memory:
#> Extensions: TRUE
remote_query(mf)
#> <SQL> SELECT *
#> FROM `blorp`
mf2 <- dplyr::filter(mf, x > 3)
remote_name(mf2)
#> NULL
remote_src(mf2)
#> src: sqlite 3.50.3 [:memory:]
#> tbls: blorp, dbplyr_00si8liN6h, dbplyr_1N7gYBNlcp, dbplyr_258RgjzX6J,
#> dbplyr_3TKpjGw3nP, dbplyr_71neMYlWKq, dbplyr_74y8jQEZ1U,
#> dbplyr_7gFZ2RIqws, dbplyr_9IdGwG0v58, dbplyr_AbgKY9eIba,
#> dbplyr_BVkzIbwPcL, dbplyr_EmJho1LAQi, dbplyr_FwkzgfuPO1,
#> dbplyr_GrnDDOhsrA, dbplyr_JacgWfAlMk, dbplyr_P8gLIJILJj,
#> dbplyr_aByGT89T45, dbplyr_bOGqaBG4XI, dbplyr_crUoBF7QxM,
#> dbplyr_fLBw8zKN1y, dbplyr_lKLUUEdLie, dbplyr_lRwSZtds9u,
#> dbplyr_rKPRds3Z4q, df, dplyr::band_instruments, dplyr::band_members,
#> mtcars, sqlite_stat1, sqlite_stat4, squirrels
remote_con(mf2)
#> <SQLiteConnection>
#> Path: :memory:
#> Extensions: TRUE
remote_query(mf2)
#> <SQL> SELECT `blorp`.*
#> FROM `blorp`
#> WHERE (`x` > 3.0)