redis-del-batch
Delete the key of the key field from a Redis connect profile for each input row.
Syntax
redis-del-batch profile=STRING key=STRING
Options
- profile=STRING
- Required. Name of the Redis connect profile. Either a Redis Client (Standalone) or a Redis Client (Sentinel) profile is accepted. Example: profile=my_redis
- key=STRING
- Required. Name of the input field holding the Redis key to DEL. Example: key=user_id
Input fields
| Field | Type | Required | Description |
|---|---|---|---|
| Field named by the key option | String | Y | Redis key to delete |
Output fields
| Field | Type | Name | Description |
|---|---|---|---|
| deleted | Integer | Deleted | Number of deleted keys. 0 if the key did not exist |
| _error | String | Error | Error message for DEL failure of the row. Absent on success |
All fields of the input row are passed through unchanged, and the deleted or _error field is added.
Error codes
Parse errors
| Error message | Cause | Resolution |
|---|---|---|
| No available Redis profile | No profile with the given name exists, or the current account is not granted access to it. | Check the profile name and grant the account access to the profile. |
| profile option is required | The profile option is missing or empty. | Specify profile=profile_name. |
| key option is required | The key option is missing or empty. | Specify key=field_name. |
Runtime errors
| Error message | Cause | Resolution |
|---|---|---|
| (_error field of the output row) | A Redis error occurred while processing the row, such as a connection failure, authentication failure, timeout or WRONGTYPE. The query does not abort; the _error field is added to the row. If the connection fails, every row gets the same error. | Check the message in the _error field, the connection settings and the key type. |
| missing field_name(key) field | The field named by the key option does not exist in the input row. | Check that the input row has the field. |
Description
For each incoming row, the Redis DEL command is run with the value of the key field as the key, and the number of deleted keys is added as the deleted field. The connection is opened once when the query starts and reused for all rows.
A key that does not exist is not an error; it is recorded as deleted=0. Deletion cannot be undone, so check the target keys with a lookup before running it.
Examples
Example: Deleting a session key
Situation: Delete the session key of a user ID.
Expected result:
| session_key | deleted |
|---|---|
| session:1001 | 1 |
Interpretation: deleted of 0 means the key was already gone.