写入 Redis 字符串
string 数据类型可用于从 源表。
在下面的示例作业中,title
列从invoice
表。
这title
然后,将作为
形式AlbumTitle:42
,其中42
是表的主键值(albumid
列)。
这connection
是一个可选参数,它引用config.yaml
.
当您指定data_type
参数,它会覆盖系统范围的设置target_data_type
定义于config.yaml
.在这里,string
数据类型还需要args
款
替换为value
参数,该参数指定要从源表中捕获的列。
可选的expire
parameter 设置新 key 将
persist for (此处为 86400 秒,等于 1 天)。
在此时间之后,密钥将自动删除。
如果您不提供expire
参数,则密钥永远不会过期。
source:
server_name: chinook
table: album
row_format: full
output:
- uses: redis.write
with:
connection: target
data_type: string
key:
expression: concat(['AlbumTitle:', values(key)[0]])
language: jmespath
args:
value: title
expire: 86400