Configure Redis Sink Data Structures
mainYou can control how Flink data is mapped to Redis values using the value.data.structure parameter in your DDL.
value.data.structure = 'column' (Default)
In this mode, the key is determined by the order of fields in the DDL. There is no explicit mapping of a primary key to a Redis key; instead, fields are mapped to specific parts of the Redis command.
Example (SET):
-- username is the key, passport is the value
CREATE TABLE sink_redis(username VARCHAR, passport VARCHAR) WITH ('command'='set');Example (HSET):
-- name is the map key, subject is the field, score is the value
CREATE TABLE sink_redis(name VARCHAR, subject VARCHAR, score VARCHAR) WITH ('command'='hset');value.data.structure = 'row'
In this mode, the entire row is taken as the value, with fields separated by the \01 delimiter.
Example (SET):
CREATE TABLE sink_redis(username VARCHAR, passport VARCHAR) WITH ('command'='set');
-- Key: username, Value: username\01passportExample (HSET):
CREATE TABLE sink_redis(name VARCHAR, subject VARCHAR, score VARCHAR) WITH ('command'='hset');
-- Key: name, Field: subject, Value: name\01subject\01scorecreate table sink_redis(username VARCHAR, passport VARCHAR) with ('command'='set')
create table sink_redis(name VARCHAR, subject VARCHAR, score VARCHAR) with ('command'='hset')
create table sink_redis(username VARCHAR, passport VARCHAR) with ('command'='set')
#key: username , value: username\01passport.
create table sink_redis(name VARCHAR, subject VARCHAR, score VARCHAR)
key: name, field:subject, value: name\01subject\01score.