Postgre Actions
Postgre Actions are used to interact with tables in Postgre Server
Actions
postgre.open
Open a new connection with database
Parameters:
host - IP or hostname of the server to connect
user - Username to be used on Postgre authentication
password - Password to be used on Postgre authentication
database - Name of the database to connect with
port (optional) - Number of the port to connect with Postgre Server (default=5432)
Return:
connection - Connection object with server
Exceptions:
ConnectionException - When problems with Postgre Server connection occurs
postgre.close
Closes connection with Postgre Server
Parameters:
connection - Connection object with server. Connections are created using postgre.open action
Return:
This action has no return.
Exceptions:
This action returns no Exception
postgre.commit
Commit the transation on Postgre Server
Parameters:
connection - Connection object with server. Connections are created using postgre.open action
Return:
This action has no return
Exceptions:
This action returns no Exception
postgre.execute_sql
Execute a SQL command on Postgre Server
Parameters:
connection - Connection object with server. Connections are created using postgre.open action
sql - String with SQL command to be executed
auto_commit (optional) - Set if the auto commit on transaction should be used or not (default=True)
Return:
result - Grid with all results returned for SQL command
count - Number of lines returned by result
affected_rows - Number of lines affected by SQL command execution
Exceptions:
ConnectionException - When problems with Postgre Server connection occurs
postgre.rollback
Rollback all transactions of the given connection
Parameters:
connection - Connection object with server. Connections are created using postgre.open action
Return:
This action has no return.
Exceptions:
This action returns no Exception
postgre.select
Execute a SQL query on Postgre Server
Parameters:
connection - Connection object with server. Connections are created using postgre.open action
sql - String with SQL command to be executed
Return:
result - Grid with all results returned for SQL command
count - Number of lines returned by result
Exceptions:
ConnectionException - Whecn problems with Postgre Server connection occurs
postgre.get_result
Convert the result values from a SQL query into a standardized format.
Parameters:
cursor - Cursor object used to execute SQL commands on Postgre Server.
Return:
result - Grid with all rows and columns returned by the cursor, where:
- datetime
values are converted to "YYYY-MM-DD HH:MM:SS"
.
- date
values are converted to "YYYY-MM-DD"
.
- Other values are kept unchanged.
Exceptions:
This action returns no Exception.