runSQLinFile: Runs the query given in a text file on postgreSQL database

Description Usage Arguments Value Author(s) See Also Examples

View source: R/database.R

Description

Connects to postgresSQL database and runs the query given in the specified file. Also, stores the results in a .RDS file in the same location as the sqlFilePath (or in RDSpath) Possible enhancements : Option to not store as RDS

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
runSQLinFile(
  sqlFilePath,
  RDSpath = NA,
  readFromRds = TRUE,
  bkpExisting = TRUE,
  username = NA,
  password = NA,
  dbname,
  host,
  port
)

Arguments

sqlFilePath

Location of the Sql file

RDSpath

Alternate path to store the RDS file, else RDS will be stored in the same location as the sqlFilePath. If readFromRds, the RDS will be read from this location

readFromRds

Looks for the .Rds file in the same path as sqlFilePath

bkpExisting

Backup the existing RDS file

username

database user name, if not provided will be prompted

password

database passowrd, if not provided will be prompted

dbname

database name

host

database host name

port

database port

Value

data.table

Author(s)

Amit Agni

See Also

runSQLinText

Other database functions: runSQLinText()

Examples

1
runPostgreSQL_inFile(sqlFileName = here("SQL_get-dates.sql"),user = "",password="",readFromRds = F,dbname = "dw",host = "dwserver", port = 5050)

amit-agni/cutlery documentation built on Dec. 31, 2019, 2:09 p.m.