{
  "schema_version": 2,
  "id": "integrate/redis-data-integration/data-pipelines/transform-examples/redis-string-example",
  "title": "Write to a Redis string",
  "url": "https://redis.io/docs/latest/integrate/redis-data-integration/data-pipelines/transform-examples/redis-string-example/",
  "summary": "",
  "aliases": [
    "/integrate/redis-data-integration/ingest/data-pipelines/transform-examples/redis-string-example/"
  ],
  "tags": [
    "docs",
    "integrate",
    "rs",
    "rdi"
  ],
  "last_updated": "2026-09-18T16:39:51+01:00",
  "page_type": "content",
  "content_hash": "b8b86daea02ca18e10f8066628b5a25b1be5efb299a1430cbc714014f7d0afdd",
  "sections": [
    {
      "id": "content",
      "title": "Content",
      "role": "content",
      "text": "The string data type is useful for capturing a string representation of a single column from\na source table.\n\nIn the example job below, the `title` column is captured from the `album` table in the source.\nThe `title` is then written to the Redis target database as a string under a custom key of the\nform `AlbumTitle:42`, where the `42` is the primary key value of the table (the `albumid` column).\n\nThe `connection` is an optional parameter that refers to the corresponding connection name defined in\n[`config.yaml`](https://redis.io/docs/latest/integrate/redis-data-integration/data-pipelines/pipeline-config). \nWhen 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\nwith a `value` argument that specifies the column you want to capture from the source table.\n\nThe optional `expire` parameter sets the length of time, in seconds, that a new key will\npersist for after it is created (here, it is 86400 seconds, which equals one day).\nAfter this time, the key will be deleted automatically.\nIf you don't supply an `expire` parameter, the keys will never expire. \n\n[code example]"
    }
  ],
  "examples": [
    {
      "id": "content-ex0",
      "language": "yaml",
      "code": "name: Write album title to string\nsource:\n  table: album\n  row_format: full\noutput:\n  - uses: redis.write\n    with:\n      connection: target\n      data_type: string\n      key:\n        expression: concat(['AlbumTitle:', values(key)[0]])\n        language: jmespath\n      args:\n        value: title\n      expire: 86400",
      "section_id": "content"
    }
  ]
}
