read_sql | R Documentation |
Execute a database query and cache it locally as a Feather file and remotely as a Parquet file.
Cache storage locations are managed by tessilake.depths
options.
Database connection defined by an ODBC profile with the name set by the tessilake.tessitura
option.
read_sql(
query,
name = digest::sha1(query),
select = NULL,
primary_keys = NULL,
date_column = NULL,
freshness = as.difftime(7, units = "days"),
incremental = TRUE,
...
)
read_sql_table(
table_name,
schema = "dbo",
select = NULL,
primary_keys = NULL,
date_column = NULL,
freshness = as.difftime(7, units = "days"),
incremental = TRUE,
...
)
query |
character query to run on the database. |
name |
name of the query, defaults to the SHA1 hash of the query. |
select |
vector of strings indicating columns to select from database |
primary_keys |
character vector, primary keys of the table. |
date_column |
character, date column of the table showing the last date the row was updated. Defaults to "last_update_dt" if it exists in the table. |
freshness |
the returned data will be at least this fresh |
incremental |
whether or not to load data incrementally, default is |
... |
Arguments passed on to |
table_name |
character, table name without schema. |
schema |
character, database schema. Default is |
an Apache arrow::Table
an Apache arrow::Table.
read_sql_table()
: Reads a table or view from a SQL database and caches it locally using read_sql.
## Not run:
read_sql("select * from T_CUSTOMER", "t_customer",
primary_keys = "customer_no",
date_column = "last_update_dt"
)
## End(Not run)
## Not run:
read_sql_table("T_CUSTOMER")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.