Skip to content

Commit 6a902cf

Browse files
authored
Merge pull request #7703 from segmentio/db2SourceSetupUpdates
Db2 source setup updates
2 parents 97c044f + d8f256b commit 6a902cf

File tree

1 file changed

+31
-0
lines changed
  • src/connections/reverse-etl/reverse-etl-source-setup-guides

1 file changed

+31
-0
lines changed

src/connections/reverse-etl/reverse-etl-source-setup-guides/db2-setup.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
title: Db2 Reverse ETL Setup
33
---
44

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+
58
Set up Db2 as your Reverse ETL source.
69

710
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:
6770
8. If the connection is successful, click **Add source**.
6871

6972
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

Comments
 (0)