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
ParameterTypeRequiredDescription
uriVARCHARYesConnection URI; its scheme picks the store, such as 'redis://localhost:6379'
usernameVARCHARNoWITH property: username
passwordVARCHARNoWITH property: password; write it as SECRET(...) so the registry never holds it
timeoutDECIMALNoWITH property: connection timeout, such as '200ms'
key_patternsARRAY<VARCHAR>NoWITH 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

StatusBackends
Availableserving

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 VARCHARstatus VARCHARmessage VARCHAR
FM.TUTORIALS.EXTERNAL.REDIS_SRCCREATEDFeature created as not exists