Skip to content

Fix grouping by in subqueries#2021

Merged
henadzit merged 3 commits into
tortoise:developfrom
henadzit:do-not-add-alias-in-groupby
Dec 6, 2025
Merged

Fix grouping by in subqueries#2021
henadzit merged 3 commits into
tortoise:developfrom
henadzit:do-not-add-alias-in-groupby

Conversation

@henadzit

@henadzit henadzit commented Nov 23, 2025

Copy link
Copy Markdown
Contributor

Description

  • Removes redundant alias from GROUP BY in a Subquery.
  • Updates pypika-tortoise to 0.6.3

Motivation and Context

Fixes #1999.

How Has This Been Tested?

ci

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added the changelog accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@henadzit
henadzit force-pushed the do-not-add-alias-in-groupby branch 2 times, most recently from e9d895e to bb266b5 Compare November 23, 2025 21:43
@codspeed-hq

codspeed-hq Bot commented Nov 23, 2025

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #2021 will not alter performance

Comparing henadzit:do-not-add-alias-in-groupby (d49dbec) with develop (752762c)

Summary

✅ 16 untouched

@henadzit
henadzit force-pushed the do-not-add-alias-in-groupby branch 2 times, most recently from 0e443e4 to 31110d3 Compare November 26, 2025 21:50
@coveralls

coveralls commented Nov 26, 2025

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 19911400485

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 90.717%

Totals Coverage Status
Change from base Build 19726043557: 0.0%
Covered Lines: 6631
Relevant Lines: 7195

💛 - Coveralls

@henadzit
henadzit force-pushed the do-not-add-alias-in-groupby branch from 31110d3 to 4d2f03c Compare November 26, 2025 22:16
@henadzit henadzit changed the title WIP Fix grouping by in subqueries Fix grouping by in subqueries Nov 26, 2025
Comment thread Makefile Outdated
_check:
ruff format --check $(checkfiles) || (echo "Please run 'make style' to auto-fix style issues" && false)
ruff check $(checkfiles)
uv run ruff format --check $(checkfiles) || (echo "Please run 'make style' to auto-fix style issues" && false)

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.

uv run will update the uv.lock
I think it's better to run with --no-sync or set activate-environment to be true, e.g.: waketzheng@a7cad2e

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think it will. The run should use the existing lock file.

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.

I don't think it will. The run should use the existing lock file.

Imagine that you are using another mirror instead of pypi.org, for example:

export UV_DEFAULT_INDEX=https://mirrors.cloud.tencent.com/pypi/simple/
make _check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right! I didn't realize uv sync would update the lock file by default. I added --frozen which seems to be a good way to keep using the lock.

@henadzit
henadzit force-pushed the do-not-add-alias-in-groupby branch from 4d2f03c to 501b997 Compare November 29, 2025 21:10
@henadzit
henadzit force-pushed the do-not-add-alias-in-groupby branch from 1d86a20 to d49dbec Compare December 3, 2025 22:49
@henadzit
henadzit merged commit 6a32975 into tortoise:develop Dec 6, 2025
9 checks passed
@waketzheng waketzheng mentioned this pull request Dec 10, 2025
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.

Selecting a subquery with a GROUP BY clause produces invalid SQL

3 participants