Skip to content

Commit 9b5864c

Browse files
Merge pull request #494 from redis/DOC-4014-rdi-string-job-file
DOC-4014 added RDI string job config example
2 parents 83bfcca + 55848df commit 9b5864c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
Title: Write to a Redis string
3+
aliases: null
4+
alwaysopen: false
5+
categories:
6+
- docs
7+
- integrate
8+
- rs
9+
- rdi
10+
description: null
11+
group: di
12+
linkTitle: Write to a Redis string
13+
summary: Redis Data Integration keeps Redis in sync with the primary database in near
14+
real time.
15+
type: integration
16+
weight: 30
17+
---
18+
19+
The string data type is useful for capturing a string representation of a single column from
20+
a source table.
21+
22+
In the example job below, the `title` column is captured from the `invoice` table in the source.
23+
The `title` is then written to the Redis target database as a string under a custom key of the
24+
form `AlbumTitle:42`, where the `42` is the primary key value of the table (the `albumid` column).
25+
26+
The `connection` is an optional parameter that refers to the corresponding connection name defined in
27+
[`config.yaml`]({{< relref "/integrate/redis-data-integration/ingest/data-pipelines/data-pipelines#the-configyaml-file" >}}).
28+
When you specify the `data_type` parameter for the job, it overrides the system-wide setting `target_data_type` defined in `config.yaml`. Here, the `string` data type also requires an `args` subsection
29+
with a `value` argument that specifies the column you want to capture from the source table.
30+
31+
The optional `expire` parameter sets the length of time, in seconds, that a new key will
32+
persist for after it is created (here, it is 86400 seconds, which equals one day).
33+
After this time, the key will be deleted automatically.
34+
If you don't supply an `expire` parameter, the keys will never expire.
35+
36+
```yaml
37+
source:
38+
server_name: chinook
39+
table: album
40+
row_format: full
41+
output:
42+
- uses: redis.write
43+
with:
44+
connection: target
45+
data_type: string
46+
key:
47+
expression: concat(['AlbumTitle:', values(key)[0]])
48+
language: jmespath
49+
args:
50+
value: title
51+
expire: 86400
52+
```

0 commit comments

Comments
 (0)