app icon
Database Client
0.1.47

Provide workflow nodes with the ability to read and write databases.

spance/db_client_node8718 installs

DB-Client-Node

简体中文 | English

DB-Client-Node is a plugin tool designed for Dify workflows, providing database operation nodes. It currently supports PostgreSQL databases.

Features

  • Securely manages database connection information through Dify’s mechanism.
  • Supports parameterized execution of DML statements such as and .
  • Provides dynamic SQL generation with conditional logic support.
  • Implements performance-optimized batch data insertion.

Installation

To use in a Dify workflow:

  1. Install the plugin via the Dify plugin marketplace or manually download version from the release page.
  2. Configure PostgreSQL credentials in Dify’s settings.

Nodes Overview

Standard Client Nodes

Standard client nodes are used to execute DML statements such as and . Due to limitations in Dify’s tool plugin form interface, which does not support dynamic parameters, two variants are provided:

  • : Supports up to 5 SQL parameters.
  • : Supports up to 10 SQL parameters.

These nodes are identical except for the number of supported parameters.

Usage Examples

  1. Executing SQL Without Parameters

    FieldValue
    SQL
    Parameter 0-NLeave blank
  2. Executing SQL With Parameters

    FieldValue
    SQL
    Parameter 0Corresponding to : Enter a literal value or use to select a node variable
    Parameter 1Corresponding to : Enter a literal value or use to select a node variable
  3. Executing Dynamic SQL

    FieldValue
    SQL

    Parameter 0Corresponding to : Enter a literal value or use to select a node variable
    Parameter 1Corresponding to : Enter a literal value or use to select a node variable
    • The syntax uses Jinja2 templating to enable dynamic SQL. If the condition (e.g., ) is not met, that portion is excluded from the executed SQL; otherwise, it is included.

Batch Client Node

The batch client node is designed for bulk data insertion, utilizing the database’s batch submission mechanism to reduce I/O overhead and latency.

Usage Example

FieldValue
SQL
Parameter Object ListSelect an upstream node variable containing a JSON-serialized list of parameter objects, e.g., or . Examples:
-
-
Key Names for ExtractionLeave blank if the parameter list is an array. For dictionary-type lists, provide a comma-separated list of keys to extract values (in order), e.g.,

Node Output

Query Execution

For statements, the node provides the following return values:

  • : The query result data, represented as a list of rows where each row is an array of column values.
  • : A list of column names corresponding to the result set.
  • : An alternative representation of the query result data in the default return format of the plugin tool, structured as an object with column names as keys.

Example Output:

Update Execution

For , , or statements, the node returns:

  • : The number of rows affected.

Example Output:

Limitations

  • Currently supports only PostgreSQL databases.
  • The number of parameters in standard client nodes is fixed (5 or 10), limited by Dify’s form interface.
  • Dynamic SQL relies on Jinja2 syntax, which may require familiarity with templating.

Contribution Guidelines

Contributions are welcome! To participate:

  1. Fork this repository.
  2. Create a feature branch ().
  3. Commit your changes ().
  4. Push to the branch ().
  5. Submit a Pull Request.

Please ensure your code adheres to the project’s style guidelines and includes appropriate tests.

License

This project is released under the Apache License 2.0. See the file for details.

Contact

For questions or support, please submit an issue in the repository.

CATEGORY
Tool
TAGS
UTILITIES
VERSION
0.1.47
spance·04/02/2025 01:34 AM
REQUIREMENTS
Maximum memory
256MB