CREATE storage_format SCHEMA Examples | Teradata Vantage - Example: Schema for DATASET Type with Avro Storage Format - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
wgr1555383704548.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™
This example creates a schema for the Avro storage format of the DATASET type:
CREATE Avro SCHEMA chemDatasetSchema AS
'{
	"namespace": "example.avro",
 	"type": "record",
 	"name": "User",
 	"fields": [
     		{"name": "name", "type": "string"},
    		{"name": "favorite_number",  "type": ["int", "null"]},
     		{"name": "favorite_color", "type": ["string", "null"]}
 	 ]
	}';
This example creates the same schema using a byte literal which contains the UTF-8 encoded characters of the schema:
CREATE Avro SCHEMA chemDatasetSchema AS
'7B226E616D657370616365223A226578616D706C652E6176726F222C2274797065223A227265636F7264222C226E616D65223A2255736572222C226669656C6473223A5B7B226E616D65223A226E616D65222C2274797065223A22737472696E67227D2C7B226E616D65223A226661766F726974655F6E756D626572222C2274797065223A5B22696E74222C226E756C6C225D7D2C7B226E616D65223A226661766F726974655F636F6C6F72222C2274797065223A5B22737472696E67222C226E756C6C225D7D5D7D'xb;