Datastore PG

A configurable key-value datastore with support for in-memory and PostgreSQL storage.

Set

AI-generated

Overview

This node acts as a configurable key-value datastore that supports storing data either in-memory or in a PostgreSQL database. It is useful for scenarios where you need to persist or temporarily hold key-value pairs, such as caching, session storage, or simple data persistence across workflow executions. For example, you can store user session data, configuration settings, or intermediate results that need to be accessed later in the workflow.

Use Case Examples

  1. Storing a JSON object under a specific key in PostgreSQL for persistent access.
  2. Saving a string value in memory for quick retrieval during the workflow execution.

Properties

Name Meaning
Storage Backend Choose where to store the data, either in-memory (lost on restart) or in PostgreSQL (persistent).
Key Name The unique key for the data to be stored.
Value Data Type The type of data to store as the value, either string or JSON.
Value (String) The string value to store when the value data type is string.
Value (JSON) The JSON value to store when the value data type is JSON.
Output for Set/Clear Defines what the node should output after a Set or Clear operation, such as passing through input data, outputting status, outputting the saved value, or outputting only the key-value pair.

Output

JSON

  • success - Indicates if the operation was successful.
  • operation - The operation performed, e.g., 'set'.
  • key - The key under which the value was stored.
  • value - The value that was stored (if output option includes it).
  • itemCount - Number of items processed when setting multiple values for a single key.

Dependencies

  • PostgreSQL database if 'PostgreSQL' storage backend is selected, requiring appropriate credentials.

Troubleshooting

  • Error if 'Key Name' is missing when setting values, especially when processing multiple items for a single key.
  • Error if invalid JSON is provided when the value data type is JSON.
  • Error if an unknown data type is specified for the value.

Discussion