Uploading a data schema
To simplify repetitive actions related to data schema setup and data binding, you can prepare a file with data schemas and upload it. For this, follow these steps:
- In the management console
, select the folder where you want to change a data binding. - In the list of services, select Yandex Query.
- In the left-hand panel, select Bindings.
- In the line with the binding name, click
and select Edit. - Click Upload from file and select the data schema file.
- Click Modify.
Data schemas
We support multiple data schema formats:
- Text format
- JSON format
- Data Transfer compatible JSON format
Text format
The textual data schema format is most close to the SQL data definition syntax and consists of the SCHEMA
keyword and a list of fields with types. Existing data schemas can only be exported from Yandex Query in this format.
Here is an example of a data schema in text format:
SCHEMA=(
billing_account_id String NOT NULL,
billing_account_name String
)
Where:
billing_account_id
: Field name.String
: Field type.NOT NULL
: Flag indicating a required field in the source data.
JSON format
JSON schema format is designed for importing data schemas from external systems. The JSON format consists of records defining fields, their types, and flags showing whether fields are required.
Here is an example of a data schema in JSON format:
[
{
"name": "billing_account_id",
"type": "String",
"required": true
},
{
"name": "billing_account_name",
"type": "String",
"required": false
}
]
Where:
billing_account_id
: Field name.String
: Field type.required: true
: Flag indicating a required field in the source data.
Data Transfer compatible JSON format
This format is intended for compatible description of data schemas across various systems. This JSON format consists of a set of records defining fields and their types, with all fields considered optional in the source data.
Here is an example of a data schema:
[
{
"name": "billing_account_id",
"typeName": "String"
},
{
"name": "billing_account_name",
"typeName": "String"
}
]
Where:
billing_account_id
: Field name.String
: Field type.
To ensure compatibility between Yandex Query and Data Transfer, we recommend the following data types:
- INT64
- INT32
- INT16
- UINT64
- UINT32
- UINT16
- DOUBLE
- STRING
- UTF8