Package: pgTools 1.0.1

pgTools: Functions for Generating PostgreSQL Statements/Scripts

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>.

Authors:Timothy Conwell

pgTools_1.0.1.tar.gz
pgTools_1.0.1.zip(r-4.5)pgTools_1.0.1.zip(r-4.4)pgTools_1.0.1.zip(r-4.3)
pgTools_1.0.1.tgz(r-4.4-any)pgTools_1.0.1.tgz(r-4.3-any)
pgTools_1.0.1.tar.gz(r-4.5-noble)pgTools_1.0.1.tar.gz(r-4.4-noble)
pgTools_1.0.1.tgz(r-4.4-emscripten)pgTools_1.0.1.tgz(r-4.3-emscripten)
pgTools.pdf |pgTools.html
pgTools/json (API)

# Install 'pgTools' in R:
install.packages('pgTools', repos = c('https://tconwell.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/tconwell/pgtools/issues

On CRAN:

2.00 score 2 scripts 268 downloads 43 exports 16 dependencies

Last updated 2 years agofrom:ab45ad3713. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 17 2024
R-4.5-winOKNov 17 2024
R-4.5-linuxOKNov 17 2024
R-4.4-winOKNov 17 2024
R-4.4-macOKNov 17 2024
R-4.3-winOKNov 17 2024
R-4.3-macOKNov 17 2024

Exports:alterDATABASEalterSCHEMAalterTABLEarrayStrToVeccallFUNCTIONcallPROCEDUREconnectCOPYcreate_sql_scriptcreateDATABASEcreateEXTENSIONcreateFUNCTIONcreatePROCEDUREcreateSCHEMAcreateTABLEcreateTRIGGERDELETEdropDATABASEdropEXTENSIONdropFUNCTIONdropPROCEDUREdropSCHEMAdropTABLEdropTRIGGERINSERTinsert_batch_chunkerinsert_table_chunkerpg_addColumnpg_alterColumnTypepg_data_typespg_dropColumnpg_renameColumnpg_renameTablequerySELECTquoteText2sql_80_char_commentsql_commentsqlNameWalksqlTypeWalkTRUNCATEUPDATEvecToArrayStrvecToArrayStr2

Dependencies:bitbit64blobclidata.tableDBIgluehmslifecycleodbcpkgconfigRcpprlangstringitoolboxvctrs

Readme and manuals

Help Manual

Help pageTopics
Generate a PostgreSQL ALTER DATABASE statement, optionally execute the statement if con is not NULL.alterDATABASE
Generate a PostgreSQL ALTER SCHEMA statement, optionally execute the statement if con is not NULL.alterSCHEMA
Generate a PostgreSQL ALTER TABLE statement, optionally execute the statement if con is not NULL.alterTABLE
Write a PostgreSQL array as a string from a vector.arrayStrToVec
Generate a PostgreSQL statement to execute a function, optionally execute the statement if con is not NULL.callFUNCTION
Generate a PostgreSQL statement to execute a procedure, optionally execute the statement if con is not NULL.callPROCEDURE
Connect to a local database with local credentials using DBI/odbc.connect
Generate a PostgreSQL COPY command, optionally execute the statement if con is not NULL.COPY
Create a SQL script, optionally execute the statement if con is not NULL.create_sql_script
Generate a PostgreSQL CREATE DATABASE statement, optionally execute the statement if con is not NULL.createDATABASE
Generate a PostgreSQL CREATE EXTENSION statement, optionally execute the statement if con is not NULL.createEXTENSION
Generate a PostgreSQL CREATE FUNCTION statement, optionally execute the statement if con is not NULL.createFUNCTION
Generate a PostgreSQL CREATE PROCEDURE statement, optionally execute the statement if con is not NULL.createPROCEDURE
Generate a PostgreSQL CREATE SCHEMA statement, optionally execute the statement if con is not NULL.createSCHEMA
Generate a PostgreSQL CREATE TABLE statement, optionally execute the statement if con is not NULL.createTABLE
Generate a PostgreSQL CREATE TRIGGER statement, optionally execute the statement if con is not NULL.createTRIGGER
Generate a PostgreSQL DELETE statement, optionally execute the statement if con is not NULL.DELETE
Generate a PostgreSQL DROP DATABASE statement, optionally execute the statement if con is not NULL.dropDATABASE
Generate a PostgreSQL DROP EXTENSION statement, optionally execute the statement if con is not NULL.dropEXTENSION
Generate a PostgreSQL DROP FUNCTION statement, optionally execute the statement if con is not NULL.dropFUNCTION
Generate a PostgreSQL DROP PROCEDURE statement, optionally execute the statement if con is not NULL.dropPROCEDURE
Generate a PostgreSQL DROP SCHEMA statement, optionally execute the statement if con is not NULL.dropSCHEMA
Generate a PostgreSQL DROP TABLE statement, optionally execute the statement if con is not NULL.dropTABLE
Generate a PostgreSQL DROP TRIGGER statement, optionally execute the statement if con is not NULL.dropTRIGGER
Generate a PostgreSQL INSERT statement, optionally execute the statement if con is not NULL.INSERT
Helper function for INSERTinsert_batch_chunker
Helper function for INSERTinsert_table_chunker
Helper command to add a column via ALTER TABLE.pg_addColumn
Helper command to alter a column's data type via ALTER TABLE.pg_alterColumnType
PostgreSQL data typespg_data_types
Helper command to drop a column via ALTER TABLE.pg_dropColumn
Helper command to rename a column via ALTER TABLE.pg_renameColumn
Helper command to rename a table via ALTER TABLE.pg_renameTable
Generate a PostgreSQL select statement, optionally execute the statement if con is not NULL.querySELECT
Add single quotes to strings using stringi::stri_join, useful for converting R strings into SQL formatted strings.quoteText2
Add a 80 char SQL comment, intended to be used for visual breaks in documents.sql_80_char_comment
Add a single line SQL comment.sql_comment
Convert a column name into a PostgreSQL compatible name.sqlNameWalk
Get the PostgreSQL data type for a given R data type.sqlTypeWalk
Generate a PostgreSQL TRUNCATE statement, optionally execute the statement if con is not NULL.TRUNCATE
Generate a PostgreSQL UPDATE statement, optionally execute the statement if con is not NULL.UPDATE
Write a PostgreSQL array as a string using ARRAY[] format from a vector.vecToArrayStr
Write a PostgreSQL array as a string using format from a vector.vecToArrayStr2