{
  "schema_version": 2,
  "id": "integrate/redis-data-integration/data-pipelines/transform-examples/redis-set-example",
  "title": "Write to a Redis set",
  "url": "https://redis.io/docs/latest/integrate/redis-data-integration/data-pipelines/transform-examples/redis-set-example/",
  "summary": "",
  "aliases": [
    "/integrate/redis-data-integration/ingest/data-pipelines/transform-examples/redis-set-example/",
    "/integrate/redis-data-integration/data-transformation/examples/redis-set-example/",
    "/integrate/redis-data-integration/ingest/data-transformation/examples/redis-set-example/"
  ],
  "tags": [
    "docs",
    "integrate",
    "rs",
    "rdi"
  ],
  "last_updated": "2026-08-10T10:40:34+01:00",
  "page_type": "content",
  "content_hash": "936f8ea653f7d066584c0663f1c99769425ebf33bd0191b2ce9a2337a0ef3a68",
  "sections": [
    {
      "id": "content",
      "title": "Content",
      "role": "content",
      "text": "In the example below, data is captured from the source table named `invoice` and is written to a Redis set. The `connection` is an optional parameter that refers to the corresponding connection name defined in `config.yaml`. When you specify the\n`data_type` parameter for the job, it overrides the system-wide setting `target_data_type` defined in `config.yaml`.\n\nWhen writing to a set, you must supply an extra argument, `member`, which specifies the field that will be written. In this case, the result will be a Redis set with key names based on the key expression (for example, `invoices:Germany`, `invoices:USA`) and with an expiration of 100 seconds. If 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 invoices to set by country\nsource:\n  schema: public\n  table: invoice\noutput:\n  - uses: redis.write\n    with:\n      connection: target\n      data_type: set\n      key:\n        expression: concat(['invoices:', BillingCountry])\n        language: jmespath\n      args:\n        member: InvoiceId\n      expire: 100",
      "section_id": "content"
    }
  ]
}
