Custom
PostgreSQL Plugin – Custom
Summary (SEO Meta Description):
The PostgreSQL Custom action in WeHub allows you to run raw SQL queries within workflows.
It supports parameterized inputs and schema-based outputs for advanced database operations.
Overview
The Custom Action for PostgreSQL lets you execute custom SQL queries directly from workflows.
This is useful when standard actions (Insert, Select, Update, Delete, Upsert) are not enough, and you need fine-grained control over queries.
It supports:
- Manual inputs with typed parameters
- Dynamic schema mapping for both inputs and outputs
- Safe parameter substitution to avoid SQL injection
Typical Use Cases:
- Running advanced joins and subqueries
- Aggregating metrics directly in SQL
- Calling PostgreSQL functions or stored procedures
- Flexible data transformations beyond CRUD
⚙️ Configuration
| Field | Type | Description | 
|---|---|---|
| Label | String | Custom name for the action. Example: "Get Active Patients with Joins". | 
| Select Connection | Enum | Choose an existing PostgreSQL connection or create a new one. | 
| SQL | String | The SQL query to execute. Supports placeholders for dynamic inputs. | 
| Inputs (Optional) | Object | Define parameters for the SQL query (Manual toggle). Types: STRING,NUMBER,BOOLEAN,DATE,DATETIME,OBJECT,ARRAY,BYTE,ANY. | 
| Outputs (Optional) | Object | Define expected result schema (Manual toggle). Supports truncation. | 
| Schema (Optional) | Enum | Select schema for automatic validation and mapping. | 
💡 Example Use Cases
- Healthcare: Query patient encounters by joining Appointment and Practitioner tables.
- Finance: Aggregate transactions and return top spenders.
- Operations: Fetch and transform records for dashboards directly in SQL.
FAQ
Q: Can I run multiple SQL statements in one action?
A: No. The Custom action expects a single SQL query per execution for safety and consistency.
Q: What happens if the query returns multiple rows?
A: All rows are included in the output under the defined schema.
Q: Are transactions supported?
A: Transactions can be handled by writing SQL transaction blocks (BEGIN ... COMMIT), but they must be managed carefully.
Keywords: WeHub PostgreSQL Plugin, PostgreSQL Custom Query, SQL Workflow Integration, PostgreSQL Advanced Queries