|
2 | 2 | title: Db2 Reverse ETL Setup
|
3 | 3 | ---
|
4 | 4 |
|
| 5 | +> info "Db2 Reverse ETL Private Beta" |
| 6 | +> Db2 Reverse ETL is currently in Private Beta and is governed by Segment's [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}. |
| 7 | +
|
5 | 8 | Set up Db2 as your Reverse ETL source.
|
6 | 9 |
|
7 | 10 | At a high level, when you set up Db2 for Reverse ETL, the configured database user must have read permissions on any tables involved in the query and write permissions on a managed schema (`SEGMENT_REVERSE_ETL`) that Segment uses to track sync progress. Segment authenticates with your Db2 instance through a username and password.
|
@@ -67,3 +70,31 @@ To set up Db2 as your Reverse ETL source:
|
67 | 70 | 8. If the connection is successful, click **Add source**.
|
68 | 71 |
|
69 | 72 | After successfully adding your Db2 source, [add a model](/docs/connections/reverse-etl/setup/#step-2-add-a-model) and follow the rest of the steps in the Reverse ETL setup guide.
|
| 73 | + |
| 74 | +## Array and JSON support |
| 75 | + |
| 76 | +Db2 doesn't have native `ARRAY` or `JSON` data types, but Segment supports a naming-based convention to work around this limitation. |
| 77 | + |
| 78 | +### JSON columns |
| 79 | + |
| 80 | +Store JSON values in `VARCHAR` or `CLOB` columns. Segment detects them as JSON if the column name or alias ends with `_JSON`, like in this example: |
| 81 | + |
| 82 | +```sql |
| 83 | +SELECT data AS data_JSON FROM my_table; |
| 84 | +``` |
| 85 | + |
| 86 | +### Array columns |
| 87 | + |
| 88 | +Use `VARCHAR` columns with names ending in `_ARRAY` to represent arrays. The values can be either: |
| 89 | + |
| 90 | +- JSON-encoded arrays, like '["red", "green", "blue"]' |
| 91 | +- Comma-separated strings, like 'red,green,blue' |
| 92 | + |
| 93 | +Here’s how you might format array values in a query: |
| 94 | + |
| 95 | +```sql |
| 96 | +SELECT colors AS colors_ARRAY FROM items; |
| 97 | +``` |
| 98 | + |
| 99 | +> info "" |
| 100 | +> Segment uses column names to infer data types. For best results, follow the `_JSON` and `_ARRAY` naming conventions exactly. |
0 commit comments