Example: Converting a DATASET STORAGE FORMAT CSV Value to AVRO

Teradata Vantageā„¢ DATASET Data Type

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1198-162K
In this example, each CSV record is converted to one output row composed of one AVRO record, along with its schema.
CREATE TABLE csv_table_1(pkey INTEGER,
csv DATASET STORAGE FORMAT CSV);
INSERT INTO csv_table_1 values(0,
'ItemID,ItemName,Quantity,Price;10021,Paint Brush,10,10.99;10033,Paint,3,24.99'); 
SELECT data.ToJson() FROM CSV_TO_AVRO
(
ON (SELECT csv FROM csv_table_1)
USING SCHEMA('{"record_delimiter":";"}')
) AS csv; 
> {"ItemID":"10021","ItemName":"Paint Brush","Quantity":"10","Price":
"10.99"}
> {"ItemID":"10033","ItemName":"Paint","Quantity":"3","Price":"24.99"}