Strings functions in the Redis DuckDB extension
Function category
Strings
4 functionsGET / SET / MGET against Redis string keys. The simplest key-value layer — read and write opaque values.
Signature
redis_get(key: VARCHAR, secret_name: VARCHAR) → VARCHAR
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
key
|
Type
VARCHAR
|
Mode Positional | Description |
Argument
secret_name
|
Type
VARCHAR
|
Mode Positional | Description |
Description
Get the value of a string key. Returns NULL if the key does not exist.
1
Example 1
SELECT redis_get('mykey', 'my_redis_secret');
2
Example 2
SELECT redis_get(key_column, 'my_redis_secret') FROM my_table;
Signature
redis_mget(keys: VARCHAR, secret_name: VARCHAR) → VARCHAR
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
keys
|
Type
VARCHAR
|
Mode Positional | Description |
Argument
secret_name
|
Type
VARCHAR
|
Mode Positional | Description |
Description
Get multiple values in one round-trip. Keys are passed as a comma-separated string; values come back comma-separated in the same order, with an empty entry for each missing key so positions line up. Ambiguous when values contain commas or are empty strings: prefer redis_mget_list.
1
Example 1
SELECT redis_mget('key1,key2,key3', 'my_redis_secret');
Signature
redis_mget_list(keys: VARCHAR[], secret_name: VARCHAR) → VARCHAR[]
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
keys
|
Type
VARCHAR[]
|
Mode Positional | Description |
Argument
secret_name
|
Type
VARCHAR
|
Mode Positional | Description |
Description
Get multiple values in one round-trip, typed: takes the keys as a VARCHAR[] and returns a VARCHAR[] of the same length, with NULL for each missing key. Values containing commas or empty strings stay unambiguous. DuckDB 2.0 build.
1
Example 1
SELECT redis_mget_list(['key1', 'key2', 'key3'], 'my_redis_secret');
2
Example 2
SELECT redis_mget_list(list(key), 'my_redis_secret') FROM my_keys;
Signature
redis_set(
key: VARCHAR,
value: VARCHAR,
secret_name: VARCHAR
) → VARCHAR
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
key
|
Type
VARCHAR
|
Mode Positional | Description |
Argument
value
|
Type
VARCHAR
|
Mode Positional | Description |
Argument
secret_name
|
Type
VARCHAR
|
Mode Positional | Description |
Description
Set the value of a string key.
1
Example 1
SELECT redis_set('mykey', 'myvalue', 'my_redis_secret');