target-postgres icon indicating copy to clipboard operation
target-postgres copied to clipboard

Denesting - is there a way to not denest primitive arrays?

Open MattMacGillivray opened this issue 5 years ago • 2 comments

Denesting makes sense for complex objects, but if my postgres tap pulls out an integer[] (integer array), the target always denests it into a separate table. Is there a way for the target to insert it as an integer array?

Below is my partial config relating to the integer[] column.

         {
            "breadcrumb": [
               "properties",
               "label_ids"
            ],
            "metadata": {
               "sql-datatype": "integer[]",
               "inclusion": "available",
               "selected-by-default": true,
               "selected": true
            }
         }
            "label_ids": {
               "type": "array",
               "items": {
                  "type": "integer"
               }
            }

MattMacGillivray avatar Aug 21 '19 15:08 MattMacGillivray

@qmnonic We typically follow what Stitch does and they denest basic types in a similar way. We also have shared logic in denesting that works for other SQL-like targets (Redshift, Snowflake) and try to avoid target specific typing. Stitch does this for the same reason, avoiding lots of target specific code and added complexity.

The target also doesn't see the metadata, only the schema, so if this was added the logic would be only on the schema. It would also have to be optional.

Another option we've discussed is a config option to turn off denesting completely or potentially for a list of stream names. Everything that is nested would be a JSONB type.

awm33 avatar Aug 21 '19 17:08 awm33

Any updates on this since 2019?

dmcquay avatar Mar 28 '24 17:03 dmcquay