mk_td | R Documentation |
Build minimal structures (table name and column names) needed to represent data from a remote table.
mk_td(
table_name,
columns,
...,
qualifiers = NULL,
q_table_name = NULL,
head_sample = NULL,
limit_was = NULL
)
table_source(
table_name,
columns,
...,
qualifiers = NULL,
q_table_name = NULL,
head_sample = NULL,
limit_was = NULL
)
table_name |
character, name of table |
columns |
character, column names of table (non-empty and unique values). |
... |
not used, force later argument to bind by name |
qualifiers |
optional named ordered vector of strings carrying additional db hierarchy terms, such as schema. |
q_table_name |
optional character, qualified table name, note: has to be re-generated for different DB connections. |
head_sample |
optional, head_sample of table as an example |
limit_was |
optional, row limit used to produce head_sample. |
Generate a query that returns contents of a table, we could try to eliminate this (replace the query with the table name), but there are features one can work with with the query in place and SQL optimizers likely make this zero-cost anyway.
a relop representation of the data
table_source()
: old name for mk_td
db_td
, local_td
db_td
, local_td
, rq_copy_to
, materialize
, execute
, to_sql
if (requireNamespace("DBI", quietly = TRUE) && requireNamespace("RSQLite", quietly = TRUE)) {
my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
rq_copy_to(my_db,
'd',
data.frame(AUC = 0.6, R2 = 0.2),
overwrite = TRUE,
temporary = TRUE)
d <- mk_td('d',
columns = c("AUC", "R2"))
print(d)
sql <- to_sql(d, my_db)
cat(sql)
print(DBI::dbGetQuery(my_db, sql))
DBI::dbDisconnect(my_db)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.