Skip to content

[BUG] Unexpected row_condition behavior in expect_table_aggregation_to_equal_other_table #35

@jeffkeller-einc

Description

@jeffkeller-einc

Is this a new bug in dbt-expectations?

  • I believe this is a new bug in dbt-expectations
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

When row_condition is set but compare_row_condition is not set, the row_condition is also applied to the comparison model.

Expected Behavior

No condition is applied to the comparison model. Or, this behavior becomes documented in the README.

Steps To Reproduce

This test fails to run at all if another_table.marketed_date does not exist.

- dbt_expectations.expect_table_aggregation_to_equal_other_table:
    arguments:
      expression: SUM(total)
      row_condition: marketed_date > '2025-10-16'
      group_by: ["marketed_date"]
      compare_model: ref("another_table")
      compare_expression: COUNT(*)
      compare_group_by: ["event_date"]

The workaround is to override compare_row_condition with something vacuous.

- dbt_expectations.expect_table_aggregation_to_equal_other_table:
    arguments:
      expression: SUM(total)
      row_condition: marketed_date > '2025-10-16'
      group_by: ["marketed_date"]
      compare_model: ref("another_table")
      compare_expression: COUNT(*)
      compare_row_condition: 1 = 1
      compare_group_by: ["event_date"]

Environment

- OS: macOS 15.7.1
- Python: 3.12.8
- dbt: 1.10.13
- dbt-expectations: 0.10.9

Which database adapter are you using with dbt?

  • Postgres

Additional Context

Possibly related to #13 but that issue lacks details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions