Overview
ThegetInfoInDatabaseActivity executes a database query to retrieve information about a node. Itβs used to fetch node configuration, type, and data before processing.
Purpose
- Retrieve node details from the database
- Get node type to determine processing logic
- Access node configuration and data
- Validate node existence before execution
When itβs executed
This activity is called early in the workflow execution:- After status notification: Right after notifying that execution has started
- Before processing: Before any node-specific processing begins
- Node validation: To ensure the node exists and can be processed
Signature
Inputs
| Parameter | Type | Description |
|---|---|---|
query | string | SQL query string to execute |
params | any[] | Array of parameters for the SQL query (prevents SQL injection) |
Outputs
Returns the first row from the query result as an object. If no rows are found, throws an error.Implementation details
The activity uses theDatabaseService to execute the query. It:
- Executes the query with the provided parameters
- Checks if any rows were returned
- Throws an error if no data is found
- Returns the first row as an object
Example usage in workflow
Common query patterns
Get node by ID
Get multiple nodes
Error handling
The activity throws an error if:- No rows are returned from the query
- The database connection fails
- The query syntax is invalid
Return structure
The returned object structure depends on the query, but typically includes:type: Node type (e.g.,TEXT_GENERATOR)flow_id: ID of the flow containing the nodedata: JSON object containing node configuration and settings