SOURCE_KV()
All functions > SOURCE > SOURCE_KV()
Creates a connection to a key-value store (Redis), picked by the URI's scheme
Signatures
Returns: Key-value source for online reads
SOURCE_KV( uri [ WITH ( property = value, ... ) ] ) → KVSOURCE
| Parameter | Type | Required | Description |
|---|---|---|---|
uri | VARCHAR | Yes | Connection URI; its scheme picks the store, such as 'redis://localhost:6379' |
username | VARCHAR | No | WITH property: username |
password | VARCHAR | No | WITH property: password; write it as SECRET(...) so the registry never holds it |
timeout | DECIMAL | No | WITH property: connection timeout, such as '200ms' |
key_patterns | ARRAY<VARCHAR> | No | WITH property: key patterns queries may read |
Notes
- Connects to a key-value store: Redis (
redis://) - Used for low-latency key-value lookups
- Connection pooled and reused across requests
- Supports Redis Strings and Hashes
- key_patterns limits accessible keys for security
- Online-only restriction (for low-latency serving)
- Used with EXTERNAL_KV for real-time lookups
Availability
| Status | Backends |
|---|---|
| Available | serving |
See also
Examples
Persist a Redis source
FeatureQL
CREATE OR REPLACE FEATURE FM.TUTORIALS.EXTERNAL.REDIS_SRC AS
SOURCE_KV(
'redis://host.docker.internal:26379'
WITH (
timeout='500ms',
key_patterns=ARRAY['serving_slt:customer_hash:*']
)
);Result
| feature_name VARCHAR | status VARCHAR | message VARCHAR |
|---|---|---|
| FM.TUTORIALS.EXTERNAL.REDIS_SRC | CREATED | Feature created as not exists |