From 55848dfb2cbde9feab30f4a93238ed8c801d880c Mon Sep 17 00:00:00 2001 From: Andy Stark Date: Fri, 26 Jul 2024 16:10:40 +0100 Subject: [PATCH] DOC-4014 added RDI string job config example --- .../redis-string-example.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 content/integrate/redis-data-integration/ingest/data-pipelines/transform-examples/redis-string-example.md diff --git a/content/integrate/redis-data-integration/ingest/data-pipelines/transform-examples/redis-string-example.md b/content/integrate/redis-data-integration/ingest/data-pipelines/transform-examples/redis-string-example.md new file mode 100644 index 0000000000..c38f9afc2a --- /dev/null +++ b/content/integrate/redis-data-integration/ingest/data-pipelines/transform-examples/redis-string-example.md @@ -0,0 +1,52 @@ +--- +Title: Write to a Redis string +aliases: null +alwaysopen: false +categories: +- docs +- integrate +- rs +- rdi +description: null +group: di +linkTitle: Write to a Redis string +summary: Redis Data Integration keeps Redis in sync with the primary database in near + real time. +type: integration +weight: 30 +--- + +The string data type is useful for capturing a string representation of a single column from +a source table. + +In the example job below, the `title` column is captured from the `invoice` table in the source. +The `title` is then written to the Redis target database as a string under a custom key of the +form `AlbumTitle:42`, where the `42` is the primary key value of the table (the `albumid` column). + +The `connection` is an optional parameter that refers to the corresponding connection name defined in +[`config.yaml`]({{< relref "/integrate/redis-data-integration/ingest/data-pipelines/data-pipelines#the-configyaml-file" >}}). +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 +with a `value` argument that specifies the column you want to capture from the source table. + +The optional `expire` parameter sets the length of time, in seconds, that a new key will +persist for after it is created (here, it is 86400 seconds, which equals one day). +After this time, the key will be deleted automatically. +If you don't supply an `expire` parameter, the keys will never expire. + +```yaml +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 +``` \ No newline at end of file