pgTools1.0.2 package

Functions for Generating PostgreSQL Statements/Scripts

alterDATABASE

Generate a PostgreSQL ALTER DATABASE statement, optionally execute the...

alterSCHEMA

Generate a PostgreSQL ALTER SCHEMA statement, optionally execute the s...

alterTABLE

Generate a PostgreSQL ALTER TABLE statement, optionally execute the st...

arrayStrToVec

Write a PostgreSQL array as a string from a vector.

callFUNCTION

Generate a PostgreSQL statement to execute a function, optionally exec...

callPROCEDURE

Generate a PostgreSQL statement to execute a procedure, optionally exe...

connect

Connect to a local database with local credentials using DBI/odbc.

COPY

Generate a PostgreSQL COPY command, optionally execute the statement i...

create_sql_script

Create a SQL script, optionally execute the statement if con is not NU...

createDATABASE

Generate a PostgreSQL CREATE DATABASE statement, optionally execute th...

createEXTENSION

Generate a PostgreSQL CREATE EXTENSION statement, optionally execute t...

createFUNCTION

Generate a PostgreSQL CREATE FUNCTION statement, optionally execute th...

createPROCEDURE

Generate a PostgreSQL CREATE PROCEDURE statement, optionally execute t...

createSCHEMA

Generate a PostgreSQL CREATE SCHEMA statement, optionally execute the ...

createTABLE

Generate a PostgreSQL CREATE TABLE statement, optionally execute the s...

createTRIGGER

Generate a PostgreSQL CREATE TRIGGER statement, optionally execute the...

DELETE

Generate a PostgreSQL DELETE statement, optionally execute the stateme...

dropDATABASE

Generate a PostgreSQL DROP DATABASE statement, optionally execute the ...

dropEXTENSION

Generate a PostgreSQL DROP EXTENSION statement, optionally execute the...

dropFUNCTION

Generate a PostgreSQL DROP FUNCTION statement, optionally execute the ...

dropPROCEDURE

Generate a PostgreSQL DROP PROCEDURE statement, optionally execute the...

dropSCHEMA

Generate a PostgreSQL DROP SCHEMA statement, optionally execute the st...

dropTABLE

Generate a PostgreSQL DROP TABLE statement, optionally execute the sta...

dropTRIGGER

Generate a PostgreSQL DROP TRIGGER statement, optionally execute the s...

INSERT

Generate a PostgreSQL INSERT statement, optionally execute the stateme...

insert_batch_chunker

Helper function for INSERT

insert_table_chunker

Helper function for INSERT

pg_addColumn

Helper command to add a column via ALTER TABLE.

pg_alterColumnType

Helper command to alter a column's data type via ALTER TABLE.

pg_data_types

PostgreSQL data types

pg_dropColumn

Helper command to drop a column via ALTER TABLE.

pg_renameColumn

Helper command to rename a column via ALTER TABLE.

pg_renameTable

Helper command to rename a table via ALTER TABLE.

querySELECT

Generate a PostgreSQL select statement, optionally execute the stateme...

quoteText2

Add single quotes to strings using stringi::stri_join, useful for conv...

sql_80_char_comment

Add a 80 char SQL comment, intended to be used for visual breaks in do...

sql_comment

Add a single line SQL comment.

sqlNameWalk

Convert a column name into a PostgreSQL compatible name.

sqlTypeWalk

Get the PostgreSQL data type for a given R data type.

TRUNCATE

Generate a PostgreSQL TRUNCATE statement, optionally execute the state...

UPDATE

Generate a PostgreSQL UPDATE statement, optionally execute the stateme...

vecToArrayStr

Write a PostgreSQL array as a string using ARRAY[] format from a vecto...

vecToArrayStr2

Write a PostgreSQL array as a string using format from a vector.

Create PostgreSQL statements/scripts from R, optionally executing the SQL statements. Common SQL operations are included, although not every configurable option is available at this time. SQL output is intended to be compliant with PostgreSQL syntax specifications. PostgreSQL documentation is available here <https://www.postgresql.org/docs/current/index.html>.

  • Maintainer: Timothy Conwell
  • License: GPL (>= 3)
  • Last published: 2023-03-24