This endpoint is in preview and may be modified or removed at any time.
To use this endpoint, add preview=true to the request query parameters.
Adds a schema on an existing dataset using a PUT request.
Third-party applications using this endpoint via OAuth2 must request the following operation scope: api:datasets-write.
objectstringThe name of a Branch.
string (enum)The dataframe reader used for reading the dataset schema. Defaults to PARQUET.
Enum values: AVRO, CSV, PARQUET, DATASOURCE
stringThe Resource Identifier (RID) of the end Transaction.
objectThe schema that will be added.
objectstringThe name of a Branch.
stringThe Resource Identifier (RID) of a Transaction.
objectThe schema for a Foundry dataset. Files uploaded to this dataset must match this schema.
stringThe version identifier of a dataset schema.
1
2
3
4
5
curl -X PUT \
\t-H "Content-type: application/json" \
\t-H "Authorization: Bearer $TOKEN" \
"https://$HOSTNAME/api/v2/datasets/ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da/putSchema?preview=true" \
-d '{"endTransactionRid":"ri.foundry.main.transaction.0a0207cb-26b7-415b-bc80-66a3aa3933f4","schema":{"fieldSchemaList":[{"name":"id","type":"LONG","nullable":false,"customMetadata":{"description":"Primary key"}},{"name":"event_time","type":"TIMESTAMP","nullable":false},{"name":"price","type":"DECIMAL","precision":10,"scale":2,"nullable":true},{"name":"tags","type":"ARRAY","nullable":true,"arraySubtype":{"type":"STRING","nullable":false}},{"name":"metrics","type":"STRUCT","nullable":true,"subSchemas":[{"name":"temperature","type":"DOUBLE","nullable":true},{"name":"humidity","type":"DOUBLE","nullable":true}]}]},"dataframeReader":"PARQUET","branchName":"master"}'1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
"endTransactionRid": "ri.foundry.main.transaction.0a0207cb-26b7-415b-bc80-66a3aa3933f4",
"schema": {
"fieldSchemaList": [
{
"name": "id",
"type": "LONG",
"nullable": false,
"customMetadata": {
"description": "Primary key"
}
},
{
"name": "event_time",
"type": "TIMESTAMP",
"nullable": false
},
{
"name": "price",
"type": "DECIMAL",
"precision": 10,
"scale": 2,
"nullable": true
},
{
"name": "tags",
"type": "ARRAY",
"nullable": true,
"arraySubtype": {
"type": "STRING",
"nullable": false
}
},
{
"name": "metrics",
"type": "STRUCT",
"nullable": true,
"subSchemas": [
{
"name": "temperature",
"type": "DOUBLE",
"nullable": true
},
{
"name": "humidity",
"type": "DOUBLE",
"nullable": true
}
]
}
]
},
"versionId": "0000000d-2acf-537c-a228-3a9fe3cdc523",
"branchName": "master"
}| Error Name | ||
|---|---|---|
Branch | Error Code | NOT_FOUND |
| Status Code | 404 | |
| Description | The requested branch could not be found, or the client token does not have access to it. | |
| Parameters | datasetRid, branchName | |
Dataset | Error Code | NOT_FOUND |
| Status Code | 404 | |
| Description | The requested dataset could not be found, or the client token does not have access to it. | |
| Parameters | datasetRid | |
Invalid | Error Code | INVALID_ARGUMENT |
| Status Code | 400 | |
| Description | The schema failed validations | |
| Parameters | errorType, message | |
Dataset | Error Code | NOT_FOUND |
| Status Code | 404 | |
| Description | The requested dataset view could not be found. A dataset view represents the effective file contents of a dataset for a branch at a point in time, calculated from transactions (SNAPSHOT, APPEND, UPDATE, DELETE). The view may not exist if the dataset has no transactions, contains no files, the branch is not valid, or the client token does not have access to it. | |
| Parameters | datasetRid, branch | |
Put | Error Code | PERMISSION_DENIED |
| Status Code | 403 | |
| Description | Could not putSchema the Dataset. | |
| Parameters | datasetRid | |
See Errors for a general overview of errors in the platform.