get_query: Retreive a database query with SQL, with caching and lazy...

Description Usage Arguments Value

Description

A convenience function which wraps dbGetQuery, by default providing some local caching. The function is deliberately lazy at the cost of being unpredictable in edge-cases – if sql resolves to a valid file, it will be read in as a SQL statement, if it does not, the string will be passed directly to the server as an SQL statement.

Usage

1
2
get_query(sql = NULL, con = guess_db_connection(), local_cache = TRUE,
  cache_dir = "./.sql_cache", gitignore = TRUE, verbose = FALSE)

Arguments

sql

character. Either a path to an existent text file which will be read in as a valid SQL statement and submitted to the sever. If the file does not exist, sql will be treated as a valid SQL statement and submitted to the server

con

A database connection. If unspecified, and there is a single database connection in the global environment, this will be used

local_cache

Should results be cached locally as .RData files via saveRDS?

cache_dir

The directory in which to cache files

gitignore

Should the cache directory be .gitignored?

verbose

Should the function tell you how it's processing the strings passed to sql, via message?

Value

The results of passing the SQL statement to dbGetQuery


brendan-r/brocks documentation built on May 13, 2019, 5:08 a.m.