PostgreSQL Exec

Description

The PostgreSQL Execc component allows you to execute SQL statements against PostgreSQL to update/delete data.
It supports PostgreSQL 11 and above.

Output payload








Output PayloadDescription
cv.PayloadPass LastInsertId or RowsAffected depending on the SQL statement executed in addition to the input payload

LastInsertId is returned if the SQL statement executed was an INSERT statement and the ID generated by the DB can be retrieved.
RowsAffected returns the number of records affected by the SQL statement executed. For example, if it was a DELETE statement, the number of rows deleted is returned.

Component property






Property NameDescription
SQLSpecify SQL statement to execute
Bulk ModeSelect whether to use bulk mode for SQL statement execution
Bulk SizeSpecify the size if bulk mode is used
HostSpecify PostgreSQL host.
PortSpecify the PostgreSQL port.
UsernameSpecify a PostgreSQL username.
PasswordSpecify the PostgreSQL password.
DatabaseSpecifies a database.
TimezoneSpecify the timezone for the database
SSLModeThe encryption of the communication can be disable (no SSL/TLS connection), allow (first try a connection without SSL/TLS connection and if the connection fails, then try a SSL/TLS connection), prefer (first try a connection with SSL/TLS connection and if the connection fails, then try a connection without SSL/TLS connection), or require (try a connection with SSL/TLS connection). connection), prefer (first try an SSL/TLS connection and if it fails to connect, then try a non-SSL/TLS connection), require (make an SSL/TLS connection. (makes an SSL/TLS connection and verifies the server certificate if specified, but not if not specified), verify-ca (makes an SSL/TLS connection and verifies the server certificate), verify-full (verifies the SSL/TLS connection and the server certificate, and also verifies the server name)
Root CertificateSpecify the root certificate to use; if you are using AWS Aurora or RDS, you must use a server certificate issued by AWS. This will be the root certificate for that server certificate.

Placeholder

You must use a placeholder in the SQL statement to be executed to use the value of cv.Playload in the SQL statement.

UPDATE table1 SET name='update name' WHERE id=$1

The value of cv.Payload is used for the placeholder specified in $1. When cv.Payload contains 1, the record with id 1 is updated.

More than one placeholder may be specified. For example:

UPDATE table1 SET name=$1 WHERE id=$2

To specify values for more than one placeholder, specify the values in an array in cv.

["First Last", 20]

Text2SQL

Text2SQL is a function that allows you to generate SQL statements from the Japanese you enter in the prompt for the data you wish to retrieve using OpenAI's ChatGPT functionality.
Please refer to the Text2SQL Usage Guide in the Setup Guide for how to use it.