Example: Changing the Key Names in the Avro Record - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

To change the names of the keys in the Avro records, use the SCHEMA custom clause.

SELECT data.toJSON() FROM CSV_TO_AVRO
(
	ON (SELECT csvFile FROM myCSVTable09 WHERE id=2)
	USING SCHEMA('{"record_delimiter":"#", "field_names": ["a1","a2","a3","a4","a5","a6","a7"]}')
) AS csvAvro ORDER BY data."a1";

Result:

> {"a1":"105","a2":"soap","a3":null,"a4":null,"a5":"1","a6":"0.99","a7":"0.99"}
> {"a1":"55","a2":"bicycle","a3":"red","a4":"boys","a5":"1","a6":"100.00","a7":"100.00"}
> {"a1":"88","a2":"toy boat","a3":"pink","a4":null,"a5":"1","a6":"15.10","a7":"15.10"}
> {"a1":"Item_ID","a2":"Item_Name","a3":"Item_Color","a4":"Item_Style","a5":"Quantity_Purchased","a6":"Item_Price","a7":"Total_Price"}