将作码添加到 Redis 输出

在下面的示例中,数据是从名为employee并作为 JSON 文档写入 Redis 数据库。当您指定data_type参数,它会覆盖系统范围的设置target_data_type定义于config.yaml.

在这里,结果将是 Redis JSON 文档,其中包含从源表中捕获的字段 (employeeid,firstname,lastname) 以及 一个额外的字段my_opcode使用merge更新策略(有关更多信息,请参阅 JSON 作业示例)。这opcodeexpression 引用从 源。这是一个特定于数据库的值,指示生成的作类型 更改 (INSERT、UPDATE 等) 。

source:
  schema: public
  table: employee
  row_format: full
transform:
  - uses: add_field
    with:
      field: after.my_opcode
      expression: opcode
      language: jmespath
output:
  - uses: redis.write
    with:
      data_type: json
      mapping:
        - employeeid
        - firstname
        - lastname
        - my_opcode
      connection: target
      on_update: merge
RATE THIS PAGE
Back to top ↑