Execute PostgreSQL statements.

sbf_execute_pg(
  sql,
  config_path = getOption("psql.config_path", NULL),
  config_value = getOption("psql.config_value", "default")
)

Arguments

sql

A string of the SQL statement to execute.

config_path

A string of a file path to the yaml configuration file. The default value grabs the file path from the psql.config_path option and uses NULL if no value supplied.

config_value

A string of the name of value. The default value grabs the value from the psql.config_value option and uses "default" if no value is supplied.

Value

A scalar numeric of the number of rows affected by the statement.

Details

Wrapper on psql::psql_execute_db()

Examples

if (FALSE) { # \dontrun{
sbf_execute_pg(
  "CREATE SCHEMA boat_count"
)
sbf_execute_pg(
  "CREATE TABLE boat_count.input (
  file_name TEXT NOT NULL,
  comment TEXT)"
)
} # }