-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature flag support for v2 transform command
Why these changes are being introduced: We are adding feature flag support for parquet dataset writing, aka ETL_VERSION=2, and the first step will be supporting an updated transform command for Transmogrifier. How this addresses that need: * Builds out feature flag pathway _etl_v2_generate_transform_commands_method * Adds comments for what code is feature flagged and should be addressed after v2 work is established Side effects of this change: * If ETL_VERSION=2 for this application, new pathways will be used for transform command generation Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/TIMX-441
- Loading branch information
Showing
6 changed files
with
133 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# ruff: noqa: FBT003 | ||
|
||
from lambdas import commands | ||
|
||
# NOTE: FEATURE FLAG: this file can be FULLY removed after v2 work is complete | ||
|
||
|
||
def test_generate_transform_commands_required_input_fields(run_id): | ||
input_data = { | ||
"next-step": "transform", | ||
"run-date": "2022-01-02T12:13:14Z", | ||
"run-type": "full", | ||
"source": "testsource", | ||
} | ||
extract_output_files = [ | ||
"testsource/testsource-2022-01-02-full-extracted-records-to-index.xml" | ||
] | ||
assert commands.generate_transform_commands( | ||
extract_output_files, input_data, "2022-01-02", "test-timdex-bucket", run_id | ||
) == { | ||
"files-to-transform": [ | ||
{ | ||
"transform-command": [ | ||
"--input-file=s3://test-timdex-bucket/testsource/" | ||
"testsource-2022-01-02-full-extracted-records-to-index.xml", | ||
"--output-file=s3://test-timdex-bucket/testsource/" | ||
"testsource-2022-01-02-full-transformed-records-to-index.json", | ||
"--source=testsource", | ||
] | ||
} | ||
] | ||
} | ||
|
||
|
||
def test_generate_transform_commands_all_input_fields(run_id): | ||
input_data = { | ||
"next-step": "transform", | ||
"run-date": "2022-01-02T12:13:14Z", | ||
"run-type": "daily", | ||
"source": "testsource", | ||
} | ||
extract_output_files = [ | ||
"testsource/testsource-2022-01-02-daily-extracted-records-to-index_01.xml", | ||
"testsource/testsource-2022-01-02-daily-extracted-records-to-index_02.xml", | ||
"testsource/testsource-2022-01-02-daily-extracted-records-to-delete.xml", | ||
] | ||
assert commands.generate_transform_commands( | ||
extract_output_files, input_data, "2022-01-02", "test-timdex-bucket", run_id | ||
) == { | ||
"files-to-transform": [ | ||
{ | ||
"transform-command": [ | ||
"--input-file=s3://test-timdex-bucket/testsource/" | ||
"testsource-2022-01-02-daily-extracted-records-to-index_01.xml", | ||
"--output-file=s3://test-timdex-bucket/testsource/" | ||
"testsource-2022-01-02-daily-transformed-records-to-index_01.json", | ||
"--source=testsource", | ||
] | ||
}, | ||
{ | ||
"transform-command": [ | ||
"--input-file=s3://test-timdex-bucket/testsource/" | ||
"testsource-2022-01-02-daily-extracted-records-to-index_02.xml", | ||
"--output-file=s3://test-timdex-bucket/testsource/" | ||
"testsource-2022-01-02-daily-transformed-records-to-index_02.json", | ||
"--source=testsource", | ||
] | ||
}, | ||
{ | ||
"transform-command": [ | ||
"--input-file=s3://test-timdex-bucket/testsource/" | ||
"testsource-2022-01-02-daily-extracted-records-to-delete.xml", | ||
"--output-file=s3://test-timdex-bucket/testsource/" | ||
"testsource-2022-01-02-daily-transformed-records-to-delete.txt", | ||
"--source=testsource", | ||
] | ||
}, | ||
] | ||
} |