# @file DataPulls.R
#
# Copyright 2020 Observational Health Data Sciences and Informatics
#
# This file is part of StudyManagement
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#' Gets data from a remote dbms server using database connector into dataframe
#'
#' @details
#' Gets data from a remote dbms server using database connector into dataframe
#' #'
#' #' @template optionalDatabaseSchema
#' #' @template server
#' #' @template dbms
#' #' @template port
#' #' @template sql
#' #'
#' #' @return
#' #' A data frame of data source information
#' #'
#' #'
#' #' @export
#'
#' getDataFromRemoteDbmsServer <- function(databaseSchema = NULL,
#' dbms,
#' port = NULL,
#' server,
#' sql
#' ) {
#' connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = dbms,
#' server = server,
#' port = port,
#' schema = databaseSchema)
#' connection = DatabaseConnector::connect(connectionDetails = connectionDetails)
#' sql <- SqlRender::render(sql = sql, warnOnMissingParameters = TRUE, databaseSchema = databaseSchema)
#' sql <- SqlRender::translate(sql = sql, targetDialect = dbms)
#' results <- DatabaseConnector::querySql(connection, sql)
#' DatabaseConnector::disconnect(connection = connection)
#' return(results)
#' }
#' #' Pushes data into a remote dbms server using database connector
#' #'
#' #' @details
#' #' Pushes data into a remote dbms server using database connector
#' #'
#' #' @param databaseSchema description
#' #' @param server description
#' #' @param dbms description
#' #' @param port description
#' #' @param tableName description
#' #' @param data description
#' #' @param useMppBulkLoad description
#' #'
#' #' @return
#' #' NA
#' #'
#' #'
#' #' @export
#'
#' pushDataToRemoteServer <- function(databaseSchema = NULL,
#' dbms,
#' port = NULL,
#' server,
#' tableName,
#' data,
#' useMppBulkLoad = FALSE
#' ) {
#' connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = dbms,
#' server = server,
#' port = port,
#' schema = databaseSchema)
#' connection = DatabaseConnector::connect(connectionDetails = connectionDetails)
#'
#' DatabaseConnector::insertTable(connection = connection,
#' tableName = tableName,
#' data = data,
#' dropTableIfExists = TRUE,
#' createTable = TRUE,
#' tempTable = FALSE,
#' useMppBulkLoad = useMppBulkLoad)
#' DatabaseConnector::disconnect(connection = connection)
#' }
#'
#' #' Get tables in databaseSchema
#' #'
#' #' @details
#' #' Get tables in databaseSchema
#' #'
#' #' @param databaseSchema description
#' #' @param server description
#' #' @param dbms description
#' #' @param port description
#' #'
#' #' @return
#' #' NA
#' #'
#' #'
#' #' @export
#'
#' getTablesInSchema <- function(databaseSchema = NULL,
#' dbms,
#' port = NULL,
#' server
#' ) {
#' connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = dbms,
#' server = server,
#' port = port)
#' connection = DatabaseConnector::connect(connectionDetails = connectionDetails)
#'
#' results <- DatabaseConnector::getTableNames(connection = connection, databaseSchema = databaseSchema)
#' DatabaseConnector::disconnect(connection = connection)
#' return(results)
#' }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.