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

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1144-175K
Language
English (United States)
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;