Title: | Execute 'SQL' Scripts in 'R' Containing Multiple Queries |
Version: | 1.0.2 |
Description: | The nature of working with structured query language ('SQL') scripts efficiently often requires the creation of temporary tables and there are few clean and simple 'R' 'SQL' execution approaches that allow you to complete this kind of work with the 'R' environment. This package seeks to give 'SQL' implementations in 'R' a little love by deploying functions that allow you to deploy complex 'SQL' scripts within a typical 'R' workflow. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Imports: | DBI, readr, RJDBC, odbc |
Suggests: | knitr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2025-04-16 18:19:33 UTC; skerns6 |
Author: | Kerns Sam [aut, cre] |
Maintainer: | Kerns Sam <samwkerns@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2025-04-17 06:40:01 UTC |
Query a database with multiple query actions and one, final, select statement.
Description
Requires a DBI workflow that creates a connection with a relational database per DBI: https://dbi.r-dbi.org/. This function is an extension of the DBI::dbGetQuery and RJDBC::dbSendUpdate functions.
Usage
dbGetMultiQuery(conn, conn_type = "JDBC", sql_path, pattern = NULL, replacement = NULL)
Arguments
conn |
A database connection object |
conn_type |
A string indicating if the connection type is a JDBC or ODBC connection - accepts "JDBC" or "ODBC" as arguments, defaults to "JDBC" |
sql_path |
Character vector pointing to SQL script |
pattern |
A character object you would like to substitute in the SQL script - this is not required and defaults to NULL. Calls gsub under the hood, so use regex for pattern identification. You may provide a single string or a vector of strings equal in length to the vector of strings in the replacement field. |
replacement |
A character vector replacing the pattern specified - this is not required and defaults to NULL. Calls gsub under the hood, so use regex for pattern identification. You may provide a single string or a vector of strings equal in length to the vector of strings in the replacement field. |
Value
A data object
Run multiple SQL query actions within the DB environment.
Description
Requires a DBI workflow that creates a connection with a relational database per DBI: https://dbi.r-dbi.org/. This function is an extension of the RJDBC::dbSendUpdate function.
Usage
dbSendMultiUpdate(conn, conn_type = "JDBC", sql_path)
Arguments
conn |
A database connection object |
conn_type |
A string indicating if the connection type is a JDBC or ODBC connection - accepts "JDBC" or "ODBC" as arguments, defaults to "JDBC" |
sql_path |
Character vector pointing to SQL script |
Value
No object returned - for production automation