Skip to content

Commit 4970b69

Browse files
authored
Merge pull request #31 from keboola/PST-2113-ondra
create manifest files for child tables
2 parents b215a06 + d5277ab commit 4970b69

File tree

9 files changed

+120
-10
lines changed

9 files changed

+120
-10
lines changed

src/Keboola/DynamoDbExtractor/Extractor.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ public function actionRun(string $outputPath): void
7373
$headers = $parser->parseAndWriteCsvFiles();
7474
$export->cleanup();
7575

76-
$options = new ManifestManager\Options\OutTable\ManifestOptions();
77-
$options->setIncremental($exportOptions['incremental']);
76+
foreach ($headers as $tableName => $tableHeaders) {
77+
$options = new ManifestManager\Options\OutTable\ManifestOptions();
78+
$options->setIncremental($exportOptions['incremental']);
7879

79-
if (isset($headers[$webalizedExportName])) {
80-
foreach ($headers[$webalizedExportName] as $column) {
80+
foreach ($tableHeaders as $column) {
8181
$column = trim($column, '"');
8282
$isPrimaryKey = in_array($column, $exportOptions['primaryKey'] ?? [], true);
8383
if ($isPrimaryKey) {
@@ -90,13 +90,13 @@ public function actionRun(string $outputPath): void
9090
$isPrimaryKey,
9191
));
9292
}
93-
}
9493

95-
$manifestManager->writeTableManifest(
96-
$webalizedExportName . '.csv',
97-
$options,
98-
$this->dataTypeSupport->usingLegacyManifest(),
99-
);
94+
$manifestManager->writeTableManifest(
95+
$tableName . '.csv',
96+
$options,
97+
$this->dataTypeSupport->usingLegacyManifest(),
98+
);
99+
}
100100
} else {
101101
$this->logger->info('No documents found for export ' . $exportOptions['name']);
102102
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Parsing "/tmp/run-%s/out/tables/10-movies.json"
2+
Done

tests/functional/run-scan-with-child-table/expected/data/out/files/.gitkeep

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"Transformers: Age of Extinction","d008089a1cb90697b3bbef6941c29624"
2+
"X-Men: Days of Future Past","f1f4064e7780cc73cefd9bf3e3ec5e5c"
3+
"Insidious: Chapter 2","0573c5cea38a536e2ea911e1d23ac083"
4+
"Now You See Me","4245e6dcfce5a9275511ec172690977e"
5+
"Prisoners","9b20dbf9a7f06306ef49368827ffa11b"
6+
"Rush","a214d738e894ec7c6b4137f5265daa9a"
7+
"The Hunger Games: Catching Fire","ef32318cfef9aa96c9ceb973a7b3a642"
8+
"This Is the End","94ecb1a4a5b002e7063f78d9b60cd041"
9+
"Thor: The Dark World","7f7968accdac206fed62393066f51388"
10+
"World War Z","084592b8967def33d25ef52abcc0b583"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"incremental": true,
3+
"columns": [
4+
"title",
5+
"info"
6+
],
7+
"column_metadata": {
8+
"title": [
9+
{
10+
"key": "KBC.datatype.nullable",
11+
"value": true
12+
},
13+
{
14+
"key": "KBC.datatype.basetype",
15+
"value": "string"
16+
}
17+
],
18+
"info": [
19+
{
20+
"key": "KBC.datatype.nullable",
21+
"value": true
22+
},
23+
{
24+
"key": "KBC.datatype.basetype",
25+
"value": "string"
26+
}
27+
]
28+
}
29+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"","d008089a1cb90697b3bbef6941c29624"
2+
"","f1f4064e7780cc73cefd9bf3e3ec5e5c"
3+
"7.1","0573c5cea38a536e2ea911e1d23ac083"
4+
"7.3","4245e6dcfce5a9275511ec172690977e"
5+
"8.2","9b20dbf9a7f06306ef49368827ffa11b"
6+
"8.3","a214d738e894ec7c6b4137f5265daa9a"
7+
"","ef32318cfef9aa96c9ceb973a7b3a642"
8+
"7.2","94ecb1a4a5b002e7063f78d9b60cd041"
9+
"","7f7968accdac206fed62393066f51388"
10+
"7.1","084592b8967def33d25ef52abcc0b583"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"incremental": true,
3+
"columns": [
4+
"rating",
5+
"10-movies_pk"
6+
],
7+
"column_metadata": {
8+
"rating": [
9+
{
10+
"key": "KBC.datatype.nullable",
11+
"value": true
12+
},
13+
{
14+
"key": "KBC.datatype.basetype",
15+
"value": "string"
16+
}
17+
],
18+
"10-movies_pk": [
19+
{
20+
"key": "KBC.datatype.nullable",
21+
"value": true
22+
},
23+
{
24+
"key": "KBC.datatype.basetype",
25+
"value": "string"
26+
}
27+
]
28+
}
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"parameters": {
3+
"db": {
4+
"endpoint": "http://dynamodb:8000",
5+
"accessKeyId": "key",
6+
"#secretAccessKey": "secret",
7+
"regionName": "eu-central-1"
8+
},
9+
"exports": [
10+
{
11+
"id": 1,
12+
"name": "10-movies",
13+
"table": "Movies",
14+
"enabled": true,
15+
"incremental": true,
16+
"mapping": {
17+
"title": "title",
18+
"info": {
19+
"type": "table",
20+
"destination": "info",
21+
"tableMapping": {
22+
"rating": "rating"
23+
}
24+
}
25+
}
26+
}
27+
]
28+
}
29+
}

0 commit comments

Comments
 (0)