SQL Runner Test Workflow¶
This workflow provides a simple HTTP endpoint for executing SQL queries against a PostgreSQL database. It accepts POST requests containing SQL statements and returns the query results directly.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
This appears to be a test or development utility workflow that allows external systems or developers to execute arbitrary SQL queries against a PostgreSQL database through a webhook interface. The workflow name suggests it's temporary and intended for deletion after testing.
How It Works¶
- Webhook receives request: The workflow listens for POST requests at the
/sifa-sql-execendpoint - Extract SQL query: The SQL statement is extracted from the request body (
body.sqlfield) - Execute query: The SQL is executed against the configured PostgreSQL database
- Return results: Query results are returned directly to the caller as the HTTP response
Workflow Diagram¶
graph TD
A[Webhook<br/>POST /sifa-sql-exec] --> B[Execute SQL<br/>PostgreSQL Query]
B --> C[Return Results]
Trigger¶
Webhook (HTTP POST)
- Endpoint: /sifa-sql-exec
- Method: POST
- Expected payload: JSON with sql field containing the SQL query to execute
Nodes Used¶
| Node Type | Node Name | Purpose |
|---|---|---|
| Webhook | Webhook | Receives HTTP POST requests with SQL queries |
| PostgreSQL | Execute SQL | Executes the provided SQL query against the database |
External Services & Credentials Required¶
PostgreSQL Database
- Credential: kdpTestEnv (PostgreSQL connection)
- Required permissions: Depends on the SQL queries being executed
- Database: Connected to what appears to be a test environment database
Environment Variables¶
No environment variables are used in this workflow. All configuration is handled through n8n credentials.
Data Flow¶
Input (HTTP Request Body):
1 2 3 | |
Output (HTTP Response): - Direct PostgreSQL query results - Format depends on the SQL query executed - Could be SELECT results, INSERT/UPDATE confirmation, etc.
Error Handling¶
This workflow has minimal error handling: - PostgreSQL node will fail if the SQL query is invalid or connection issues occur - No custom error handling or user-friendly error messages are implemented - Failed executions will return n8n's default error responses
Known Limitations¶
- Security Risk: Accepts arbitrary SQL queries without validation or sanitization
- No Authentication: The webhook endpoint is publicly accessible
- No Query Restrictions: Any SQL operation (SELECT, INSERT, UPDATE, DELETE, DROP) can be executed
- Test Environment Only: Appears to be intended for testing purposes only
- No Logging: No audit trail of executed queries
- No Rate Limiting: Could be subject to abuse if exposed publicly
Related Workflows¶
No related workflows identified from the provided context.
Setup Instructions¶
-
Import the workflow into your n8n instance
-
Configure PostgreSQL credentials:
- Create a new PostgreSQL credential named
kdpTestEnv - Configure connection details for your test database
- Ensure the database user has appropriate permissions for intended queries
- Create a new PostgreSQL credential named
-
Activate the workflow to enable the webhook endpoint
-
Test the endpoint:
1 2 3
curl -X POST https://your-n8n-instance/webhook/sifa-sql-exec \ -H "Content-Type: application/json" \ -d '{"sql": "SELECT NOW()"}' -
Security considerations:
- Only use in secure, test environments
- Consider adding authentication if keeping long-term
- Restrict database user permissions to minimum required
- Monitor for unauthorized access
⚠️ Warning: This workflow allows execution of arbitrary SQL queries. Only deploy in secure, controlled environments and consider implementing proper authentication and query validation before any production use.