Skip to content

Commit 91d9a66

Browse files
authored
Merge branch 'master' into devin/DMD-613-1761050115
2 parents f2c880d + 19392a3 commit 91d9a66

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

apiary.apib

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5828,6 +5828,63 @@ Delete specified workspace credentials. User will be invalidated
58285828
58295829
58305830
5831+
## Workspace Unload [/v2/storage/workspaces/{workspace_id}/unload]
5832+
5833+
### Unload workspace data [POST]
5834+
5835+
Validates Snowflake transformation component configuration and examines output mapping strategies for direct-grant tables.
5836+
Returns an array of jobs instead of a single job.
5837+
5838+
+ Parameters
5839+
+ workspace_id (required, number) - Workspace ID
5840+
5841+
+ Attributes
5842+
+ only-direct-grants (optional, boolean) - Will unload only tables with direct-grant unload strategy no others.
5843+
Default: false
5844+
5845+
+ Request (application/json)
5846+
+ Headers
5847+
5848+
X-StorageApi-Token: your_token
5849+
5850+
+ Response 202 (application/json)
5851+
+ Body
5852+
5853+
[
5854+
{
5855+
"id": 75682260,
5856+
"status": "created",
5857+
"url": "https://connection.keboola.com/v2/storage/jobs/75682260",
5858+
"tableId": null,
5859+
"operationName": "workspaceUnload",
5860+
"operationParams": {
5861+
"workspaceId": "504345774",
5862+
"table": {
5863+
"source": "out.c-bucket.table1",
5864+
"outputMappingStrategy": "direct-grant"
5865+
},
5866+
"onlyDirectGrants": false
5867+
},
5868+
"createdTime": "2025-10-22T10:15:52+0200",
5869+
"startTime": null,
5870+
"endTime": null,
5871+
"runId": null,
5872+
"results": null,
5873+
"creatorToken": {
5874+
"id": "27978",
5875+
"description": "user@keboola.com"
5876+
},
5877+
"metrics": {
5878+
"inCompressed": false,
5879+
"inBytes": 0,
5880+
"inBytesUncompressed": 0,
5881+
"outCompressed": false,
5882+
"outBytes": 0,
5883+
"outBytesUncompressed": 0
5884+
}
5885+
}
5886+
]
5887+
58315888
## Data Structures
58325889
58335890
### Workspace

src/Keboola/StorageApi/Workspaces.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,26 @@ public function queueWorkspaceCloneInto(int $id, array $options = []): int
187187
return (int) $job['id'];
188188
}
189189

190+
/**
191+
* Queue workspace unload operation
192+
*
193+
* @param int $id Workspace ID
194+
* @param array $options Optional parameters (e.g., only-direct-grants)
195+
* @return array Array of job IDs
196+
*/
197+
public function queueUnload(int $id, array $options = []): array
198+
{
199+
$url = "workspaces/{$id}/unload";
200+
if (!empty($options)) {
201+
$url .= '?' . http_build_query($options);
202+
}
203+
204+
$jobs = $this->client->apiPostJson($url, [], false);
205+
assert(is_array($jobs));
206+
207+
return array_map(fn($job) => (int) $job['id'], $jobs);
208+
}
209+
190210
public function executeQuery(int $id, string $query): array
191211
{
192212
$result = $this->client->apiPostJson(

0 commit comments

Comments
 (0)