#' import postgres data by identifier
#'
#' @description This function imports data
#' @param file is the sql script.
#' @param identifier is a vector of unique "Teilantragsnummern"
#' @return datatframe, tibble
#' @keywords import
#' @import DBI, readr
#' @export
#' @examples loadByQuery("yourSQLScript.sql", startDate = startDate, endDate = endDate)
db.get.by.identifier <- function(file, identifier) {
# enrich payment data with additional atributes from redshift
# selection is based on unique 'teilantragsnummer'
preparedStatement <-as.factor(paste0("'", identifier, "'", collapse = ','))
select <- DBI::sqlInterpolate(DBI::ANSI(), readr::read_file(paste0(getwd(),
file)), teilantragsnummer = preparedStatement)
result <- dbGetQuery(connPostgres, select)
return(result)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.