Test SQL Executor Workflow¶
A simple webhook-based SQL execution service that accepts SQL queries via HTTP POST requests and executes them against a PostgreSQL database. This is a temporary testing workflow intended for development purposes only.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
This workflow appears to be a development/testing utility that allows external systems or developers to execute arbitrary SQL queries against a PostgreSQL database through a REST API endpoint.
How It Works¶
- Webhook receives request: The workflow listens for HTTP POST requests at the
/sifa-test-sqlendpoint - Extract SQL query: The SQL query is extracted from the request body (
body.sqlfield) - Execute against database: The query is executed against the configured PostgreSQL database
- Return results: Query results are returned as the HTTP response
Workflow Diagram¶
graph TD
A[Webhook<br/>POST /sifa-test-sql] --> B[Execute SQL<br/>PostgreSQL Query]
B --> C[Return Results]
Trigger¶
Webhook (HTTP POST)
- Endpoint: /sifa-test-sql
- Method: POST
- Expected payload: JSON with sql field containing the 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 name: kdpTestEnv
- Required permissions: Depends on the SQL queries being executed (SELECT, INSERT, UPDATE, DELETE, etc.)
- Database connection details must be configured in the credential
Environment Variables¶
No environment variables are explicitly used in this workflow. All configuration is handled through the PostgreSQL credential.
Data Flow¶
Input (HTTP Request Body):
1 2 3 | |
Output (HTTP Response): Returns the raw PostgreSQL query results, which could be: - Array of objects for SELECT queries - Execution metadata for INSERT/UPDATE/DELETE queries - Error messages if the query fails
Error Handling¶
This workflow has minimal error handling: - PostgreSQL node will return database errors if queries fail - No custom error handling or validation is implemented - Malformed requests or connection issues will result in workflow execution failures
Known Limitations¶
- Security Risk: Accepts arbitrary SQL queries without validation or sanitization
- No Authentication: Webhook endpoint is unprotected
- No Query Limits: No restrictions on query complexity or execution time
- Temporary Nature: Marked for deletion after testing
- No Audit Trail: No logging of executed queries or their sources
Related Workflows¶
No related workflows identified from the provided context.
Setup Instructions¶
- Import the workflow into your n8n instance
- Configure PostgreSQL credential:
- Create a new PostgreSQL credential named
kdpTestEnv - Configure connection details (host, port, database, username, password)
- Test the connection
- 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.com/webhook/sifa-test-sql \ -H "Content-Type: application/json" \ -d '{"sql": "SELECT 1 as test"}'
⚠️ Security Warning: This workflow should only be used in development environments. Do not deploy to production without implementing proper authentication, query validation, and access controls.