17.10 - Converting CSV to Avro - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - DATASET Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1198-171K
Language
English (United States)

The following example converts CSV to Avro, where each CSV record is converted to one output row composed of one Avro record, along with its schema.

csv10.txt
Item_ID,Item_Name,Item_Color,Item_Style,Quantity_Purchased,Item_Price,Total_Price#55,bicycle,red,boys,1,100.00,100.00#88,toy boat,pink,,1,15.10,15.10#105,soap,,,1,0.99,0.99|2

CREATE TABLE myCSVTable09(
	id INTEGER,
	csvFile CLOB);

.import vartext file csv10.txt
USING (c1 VARCHAR(1000), c2 VARCHAR(10))
INSERT INTO myCSVTable09(cast(:c2 AS INTEGER),:c1);