Skip to content

Commit 173ec2a

Browse files
DOC-4305 added opcode example
1 parent 812723f commit 173ec2a

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
Title: Add the opcode to the Redis output
3+
alwaysopen: false
4+
categories:
5+
- docs
6+
- integrate
7+
- rs
8+
- rdi
9+
description: null
10+
group: di
11+
linkTitle: Add the opcode to the Redis output
12+
summary: Redis Data Integration keeps Redis in sync with the primary database in near
13+
real time.
14+
type: integration
15+
weight: 100
16+
---
17+
18+
In the example below, the data is captured from the source table named `employee` and is written to the Redis database as a JSON document. When you specify the `data_type` parameter for the job, it overrides the system-wide setting `target_data_type` defined in `config.yaml`.
19+
20+
Here, the result will be Redis JSON documents with fields captured from the source table
21+
(`employeeid`, `firstname`, `lastname`) and also with
22+
an extra field `my_opcode` added using the `merge` update strategy (see the
23+
[JSON job example]({{< relref "/integrate/redis-data-integration/data-pipelines/transform-examples/redis-json-example" >}})
24+
for more information). The `opcode` expression refers to the operation code captured from
25+
the source. This is a database-specific value that indicates which type of operation generated
26+
the change (insert, update, etc).
27+
28+
```yaml
29+
source:
30+
schema: public
31+
table: employee
32+
row_format: full
33+
transform:
34+
- uses: add_field
35+
with:
36+
field: after.my_opcode
37+
expression: opcode
38+
language: jmespath
39+
output:
40+
- uses: redis.write
41+
with:
42+
data_type: json
43+
mapping:
44+
- employeeid
45+
- firstname
46+
- lastname
47+
- my_opcode
48+
connection: target
49+
on_update: merge
50+
```

0 commit comments

Comments
 (0)