|
3 | 3 | namespace Keboola\Test\Backend\Snowflake; |
4 | 4 |
|
5 | 5 | use Keboola\Datatype\Definition\Snowflake; |
6 | | -use Keboola\StorageApi\ClientException; |
| 6 | +use Keboola\StorageApi\Options\TableImport\DeduplicationStrategy; |
7 | 7 | use Keboola\StorageApi\Workspaces; |
8 | 8 | use Keboola\TableBackendUtils\Column\ColumnCollection; |
9 | 9 | use Keboola\TableBackendUtils\Column\ColumnInterface; |
@@ -109,13 +109,8 @@ public function testUnloadFromWSToTypedTable(): void |
109 | 109 | $this->unloadAndAssert($workspace['id'], $tableId); |
110 | 110 | } |
111 | 111 |
|
112 | | - public function testUnloadFromWSToTypedTableCTAS(): void |
| 112 | + public function testUnloadFromWSToTypedTableWithoutDeduplication(): void |
113 | 113 | { |
114 | | - if (!in_array('ctas-om', $this->_client->verifyToken()['owner']['features'], true)) { |
115 | | - $this->markTestSkipped( |
116 | | - 'CTAS is not enabled for this project, skipping test.', |
117 | | - ); |
118 | | - } |
119 | 114 | // create workspace and source table in workspace |
120 | 115 | $workspace = $this->initTestWorkspace(); |
121 | 116 |
|
@@ -178,6 +173,7 @@ public function testUnloadFromWSToTypedTableCTAS(): void |
178 | 173 | $this->_client->writeTableAsyncDirect($this->tableId, [ |
179 | 174 | 'dataWorkspaceId' => $workspace['id'], |
180 | 175 | 'dataTableName' => $tableId, |
| 176 | + 'deduplicationStrategy' => DeduplicationStrategy::INSERT->value, |
181 | 177 | ]); |
182 | 178 | $eventAssertCallback = function ($events) { |
183 | 179 | $this->assertCount(1, $events); |
@@ -250,6 +246,7 @@ public function testUnloadFromWSToTypedTableCTAS(): void |
250 | 246 | 'dataWorkspaceId' => $workspace['id'], |
251 | 247 | 'dataTableName' => $tableId, |
252 | 248 | 'incremental' => true, |
| 249 | + 'deduplicationStrategy' => DeduplicationStrategy::INSERT->value, |
253 | 250 | ]); |
254 | 251 |
|
255 | 252 | $eventAssertCallback = function ($events) { |
@@ -348,16 +345,6 @@ public function testUnloadFromWSToTypedTableCTAS(): void |
348 | 345 | 'format' => 'json', |
349 | 346 | ]); |
350 | 347 | self::assertEquals($expectedIncrementalLoad, $data['rows']); |
351 | | - |
352 | | - $this->expectException(ClientException::class); |
353 | | - // create table does not support typed tables |
354 | | - // tables are created by runner and this is never called |
355 | | - $this->expectExceptionMessage('Table import error: Source destination columns mismatch. "id NUMBER (38,0) NOT NULL"->"id VARCHAR NOT NULL DEFAULT \'\''); |
356 | | - $this->_client->createTableAsyncDirect($this->getTestBucketId(self::STAGE_IN), [ |
357 | | - 'name' => 'languagesNew', |
358 | | - 'dataWorkspaceId' => $workspace['id'], |
359 | | - 'dataObject' => $tableId, |
360 | | - ]); |
361 | 348 | } |
362 | 349 |
|
363 | 350 | private function unloadAndAssert(int $id, string $tableId): void |
|
0 commit comments