Skip to content

feat(infra): Introduce a variable to control dlt write disposition behaviour for elt tasks#159

Merged
martyngigg merged 1 commit into
mainfrom
elt-script-dlt-write-disposition-option
Oct 24, 2025
Merged

feat(infra): Introduce a variable to control dlt write disposition behaviour for elt tasks#159
martyngigg merged 1 commit into
mainfrom
elt-script-dlt-write-disposition-option

Conversation

@martyngigg

@martyngigg martyngigg commented Oct 24, 2025

Copy link
Copy Markdown
Member

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

  • New Features
    • ELT tasks now support configurable write disposition through environment variables, enabling control over data writing behaviour during extraction and loading operations.

@coderabbitai

coderabbitai Bot commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

A shell template script for ELT tasks is enhanced with conditional support for the write disposition parameter. An environment variable ELT_WRITE_DISPOSITION now controls whether a --write-disposition flag is appended to the underlying uv run command execution.

Changes

Cohort / File(s) Summary
ELT task shell template
infra/ansible-docker/playbooks/elt/templates/cron/elt_task.sh.j2
Introduces ELT_WRITE_DISPOSITION environment variable and adds conditional logic to construct and append a --write-disposition flag to the extract-and-load command when the variable is set.

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

🐰 A disposition flag hops into view,
When ELT_WRITE sets the dlt queue,
Environment whispers, the command takes flight,
Write, write, write—all done just right! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat(infra): Introduce a variable to control dlt write disposition behaviour for elt tasks" directly and accurately reflects the main change in the changeset. The title clearly conveys that the modification introduces a new environment variable (ELT_WRITE_DISPOSITION) to control write disposition behaviour in the elt_task cron script, which aligns precisely with the summary showing the addition of this variable and the logic to apply it as a command-line flag. The title is concise, specific, and avoids vague terminology whilst providing sufficient context for a teammate scanning the history to understand the primary change.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch elt-script-dlt-write-disposition-option

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between c7be0cb and 5b508bb.

📒 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_REF and 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_disposition on line 64 is the correct approach:

  • When empty, it expands to no arguments
  • When set, word splitting creates separate arguments for --write-disposition and its value

This is a standard bash pattern for optional command-line arguments.

@martyngigg
martyngigg merged commit ca5a417 into main Oct 24, 2025
2 checks passed
@martyngigg
martyngigg deleted the elt-script-dlt-write-disposition-option branch October 24, 2025 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant