Skip to content

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 via tbl_lazy() or lazy_frame()?

cte

[Deprecated] Use the sql_options argument instead.

sql_options

[Experimental] 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.47.1 [:memory:]
#> tbls: blorp, dbplyr_1EmJho1LAQ, dbplyr_1qeoeBlLyC, dbplyr_6Z9IdGwG0v,
#>   dbplyr_7CsqfyfLBw, dbplyr_9Iljj7AHPg, dbplyr_BBVkzIbwPc,
#>   dbplyr_GFNKytsiP4, dbplyr_QIkai6WDzH, dbplyr_SLnb4eYrKP,
#>   dbplyr_SwlKLUUEdL, dbplyr_TpkIoXl623, dbplyr_UCWowK4ZE6,
#>   dbplyr_Xl258RgjzX, dbplyr_bi4QGpw7oQ, dbplyr_c5N9J5a51R,
#>   dbplyr_c6hVi7vmXr, dbplyr_crUoBF7QxM, dbplyr_iU2CYNMizk,
#>   dbplyr_jRmVMuJacg, dbplyr_kGJgwxHhiY, dbplyr_s9uvuVs7Tn,
#>   dbplyr_vQgF0fivjF, 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.47.1 [:memory:]
#> tbls: blorp, dbplyr_1EmJho1LAQ, dbplyr_1qeoeBlLyC, dbplyr_6Z9IdGwG0v,
#>   dbplyr_7CsqfyfLBw, dbplyr_9Iljj7AHPg, dbplyr_BBVkzIbwPc,
#>   dbplyr_GFNKytsiP4, dbplyr_QIkai6WDzH, dbplyr_SLnb4eYrKP,
#>   dbplyr_SwlKLUUEdL, dbplyr_TpkIoXl623, dbplyr_UCWowK4ZE6,
#>   dbplyr_Xl258RgjzX, dbplyr_bi4QGpw7oQ, dbplyr_c5N9J5a51R,
#>   dbplyr_c6hVi7vmXr, dbplyr_crUoBF7QxM, dbplyr_iU2CYNMizk,
#>   dbplyr_jRmVMuJacg, dbplyr_kGJgwxHhiY, dbplyr_s9uvuVs7Tn,
#>   dbplyr_vQgF0fivjF, 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)