Skip to main content

Reading JSON columns from Teradata.

  • February 17, 2022
  • 0 replies
  • 158 views

AkshayJadhav
StreamSets Employee
Forum|alt.badge.img

Teradata 15.00 and newer support a JSON data type. When querying JSON columns you can reference specific fields in the JSON.

Take the following schema as an example:

CREATE TABLE Samples.json_table (id INTEGER, json_j1 JSON);
INSERT INTO Samples.json_table VALUES (1, new JSON('{"first_name": "adam", "last_name": "kunicki"}'));

 The following query will as of 1.2.2.0 and older versions of SDC result in silently discarded rows.

SELECT id, json_j1.first_name, json_j1.last_name FROM Samples.json_table WHERE id > ${OFFSET} ORDER BY id

This is because the column name is reported for both columns by Teradata JDBC as "json_j1".

The query must be rewritten as:

SELECT id, json_j1.first_name as first_name, json_j1.last_name as last_name FROM Samples.json_table WHERE id > ${OFFSET} ORDER BY id

 

Did this topic help you find an answer to your question?

0 replies

Be the first to reply!

Reply