dbt-utils icon indicating copy to clipboard operation
dbt-utils copied to clipboard

ENHANCEMENT: dbt-utils should not allow `GROUP BY` clauses that reference column aliases

Open dataders opened this issue 2 years ago • 2 comments

offshoot of #744

There is usage of group_by that requires that the underlying data platform support using column aliases within a GROUP BY statement.

Trino, SQL Server, and others do not support this

Potential Solutions

Regardless of solution, we need standardization for when group_by is invoked.

  1. Use CTEs to avoid column aliasing
  2. introduce a dispatchable macro to allows adapter maintainers to opt-in or override the behavior in a single macro, rather than having to override entire macros

https://github.com/dbt-labs/dbt-utils/blob/6ba7b660b1d1b4e3b41cb0cf6c3c0e4a70ae54e4/macros/generic_tests/equal_rowcount.sql#L28-L38

dataders avatar Oct 09 '23 16:10 dataders

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

github-actions[bot] avatar Apr 07 '24 01:04 github-actions[bot]

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.

github-actions[bot] avatar Apr 14 '24 01:04 github-actions[bot]