Skip to content

Enhancements: Partition by list of columns for mutually_exclusive_ranges test#1076

Open
chinmaypandya wants to merge 2 commits intodbt-labs:mainfrom
chinmaypandya:feature/partition_by_column_for_mutually_exclusive_ranges_test
Open

Enhancements: Partition by list of columns for mutually_exclusive_ranges test#1076
chinmaypandya wants to merge 2 commits intodbt-labs:mainfrom
chinmaypandya:feature/partition_by_column_for_mutually_exclusive_ranges_test

Conversation

@chinmaypandya
Copy link
Copy Markdown

resolves #

Problem

Previously mutually_exclusive_ranges test accepted a single column as a partition window.

data_tests:
      - dbt_utils.mutually_exclusive_ranges:
          lower_bound_column: valid_from
          upper_bound_column: valid_to
          partition_by: subscription_id

Solution

New features includes the ability to provide list of columns for partition_by

data_tests:
      - dbt_utils.mutually_exclusive_ranges:
          lower_bound_column: valid_from
          upper_bound_column: valid_to
          partition_by:
            - subscription_id
            - region

Code Solution

Check if partition_by is a sequence (list/tuple) and handle partition clause accordingly.

{% if partition_by %}
    {% if partition_by is string %}
        {% set partition_clause = "partition by " ~ partition_by %}
    {% elif partition_by is sequence and partition_by is not string and partition_by | length > 0 %}
        {% set partition_clause = "partition by " ~ partition_by | join(', ') %}
     -- snippet
    ....
{% endif %}

Checklist

Screenshot 2026-03-15 at 7 30 54 PM

Compiled:
Screenshot 2026-03-15 at 7 41 27 PM

  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the README.md (if applicable)

@chinmaypandya chinmaypandya requested a review from a team as a code owner March 15, 2026 14:24
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.

Add a list of columns as a partition by feature to mutually_exclusive_ranges test

1 participant