Store Data (SQLite)

Store and retrieve data in a local SQLite database

Actions2

Overview

This node allows you to store and retrieve key/value data in a local SQLite database file. It is useful for scenarios where you want to persist small amounts of structured data between workflow executions without relying on external databases or services.

Common use cases include:

  • Caching API responses or intermediate results.
  • Storing configuration or state information locally.
  • Sharing data between different parts of a workflow or across multiple workflows.

For example, you can store user preferences keyed by user ID and later retrieve them to customize workflow behavior.

Properties

Name Meaning
Database File Path to the SQLite file (relative or absolute) where data will be stored or read from.
Table Name of the table in the SQLite database to store data. Must start with a letter/underscore and contain only letters, digits, or underscores. Default is kv_store.
Key Source How to determine the key for the operation: either from a field in the input JSON (Field) or a fixed value (Fixed Value).
Key Field Name When Key Source is Field, this is the name of the field in the input JSON that contains the key. Default is key.
Key Value When Key Source is Fixed Value, this is the fixed key to use. Supports expressions.
Value Field Name The name of the field in the item JSON that contains the value to store (for storing) or will receive the retrieved value (for getting). Default is value.

Additional properties used only when storing data (Operation = Store):

Name Meaning
Value Source How to determine the value to store: either from a field in the input JSON (Field) or a fixed value (Fixed Value). Default is Field.
Value When Value Source is Fixed Value, this is the fixed string value to store. Supports expressions.

Output

The output is an array of items corresponding to the input items, each containing a JSON object with the following fields:

  • For Get operation:

    • The specified Value Field Name will contain the retrieved value associated with the key, or null if not found.
    • _found: Boolean indicating whether the key was found in the database.
  • For Store operation:

    • _stored: Boolean set to true indicating the value was successfully stored.
    • _updatedAt: Timestamp (in seconds since epoch) when the value was last updated.

If an error occurs for an item and "Continue On Fail" is enabled, the output item will include an error field describing the issue.

No binary data is output by this node.

Dependencies

  • Requires access to the local filesystem to read/write the SQLite database file.
  • Uses the sql.js library (a JavaScript SQLite implementation) bundled with the node.
  • No external API keys or network dependencies are required.

Troubleshooting

  • Invalid table name error: The table name must start with a letter or underscore and contain only alphanumeric characters or underscores. Adjust the table name accordingly.
  • Missing key or value fields: If the key or value is expected from a JSON field but is missing or empty, the node will throw an error. Ensure the input items contain the specified fields or provide fixed values.
  • File access errors: If the SQLite file path is incorrect or inaccessible due to permissions, the node may fail to read or write the database. Verify the file path and permissions.
  • JSON parsing errors: When retrieving values, the node attempts to parse stored strings as JSON. Malformed JSON stored in the database may cause parsing issues.
  • Concurrent writes: Since the node reads and writes the entire SQLite file, concurrent executions might lead to race conditions or data loss. Use with caution in parallel workflows.

Links and References

Discussion