feat(infra): Introduce a variable to control dlt write disposition behaviour for elt tasks#159
Conversation
WalkthroughA shell template script for ELT tasks is enhanced with conditional support for the write disposition parameter. An environment variable Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes This is a straightforward, self-contained configuration addition involving conditional parameter handling in a single template file with minimal logic density and consistent pattern changes. Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
infra/ansible-docker/playbooks/elt/templates/cron/elt_task.sh.j2 (1)
55-58: Correct conditional logic for building the optional flag.The implementation correctly builds the write disposition argument only when the environment variable is set. The unquoted variable expansion on line 64 intentionally allows word splitting to separate the flag from its value.
As an optional enhancement, consider documenting the expected values (e.g., "replace", "append", "merge") in a comment, or adding validation to fail fast if an invalid value is provided:
dlt_write_disposition= if [ -n "$ELT_WRITE_DISPOSITION" ]; then + # Valid values: replace, append, merge dlt_write_disposition="--write-disposition $ELT_WRITE_DISPOSITION" fi
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (1)
infra/ansible-docker/playbooks/elt/templates/cron/elt_task.sh.j2(2 hunks)
🔇 Additional comments (2)
infra/ansible-docker/playbooks/elt/templates/cron/elt_task.sh.j2 (2)
7-7: LGTM! Consistent pattern for optional environment variable.The declaration follows the same pattern as
ELT_GIT_REFand correctly uses an empty default, making the write disposition override opt-in.
59-64: Well-structured command with correct handling of the optional argument.The unquoted expansion of
$dlt_write_dispositionon line 64 is the correct approach:
- When empty, it expands to no arguments
- When set, word splitting creates separate arguments for
--write-dispositionand its valueThis is a standard bash pattern for optional command-line arguments.
Summary
Previously the elt_task cron script could only use the default write disposition of the extract_and_load script. This changes introduces an optional environment variable to allow the flag to be overridden.
Summary by CodeRabbit