Re-baseline fork onto upstream v0.51.1 + ClickHouse SETTINGS - #4
Re-baseline fork onto upstream v0.51.1 + ClickHouse SETTINGS#4topher200 wants to merge 1 commit into
Conversation
Coverage Report for CI Build 30048771680Coverage decreased (-0.007%) to 98.429%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
2406102 to
cc9ecd7
Compare
### Issues Addressed Our pypika fork was pinned to an old commit whose `setup.py` parses the version with `ast.Str`, removed in Python 3.12+. Renovate builds the fork from source under Python 3.14, so any Renovate PR that regenerated a lockfile touching pypika failed to build. Upstream pypika has since revived (v0.51.1) and fixed that. ### Summary Re-add the fork on a fresh base: add the `.settings()` builder to `ClickHouseQueryBuilder`. I disabled mypy because it's already red. ### Test Plan - Ran the full suite under Python 3.14, all green: \`\`\` $ uv run --python 3.14 --with parameterized python -m unittest discover -s pypika/tests Ran 1099 tests in 0.053s OK \`\`\` - Confirmed a clean, uncached wheel build now succeeds under Python 3.14 (the build that was failing for Renovate). Resolves: PLAT-X
cc9ecd7 to
5cc586d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5cc586d. Configure here.
|
|
||
| def _format_value(v: object) -> str: | ||
| if isinstance(v, str): | ||
| return f"'{v}'" |
There was a problem hiding this comment.
Unescaped string setting values
Medium Severity
String values in the ClickHouse SETTINGS clause are wrapped in single quotes without escaping embedded apostrophes. That diverges from pypika’s usual literal formatting via format_quotes / ValueWrapper.get_formatted_value, so a setting value containing ' can yield invalid SQL when the query is rendered.
Reviewed by Cursor Bugbot for commit 5cc586d. Configure here.


Issues addressed
This is a preview of the change I intend to force-push onto this fork's
master.Our fork was pinned to an old pypika commit whose
setup.pyparses the version withast.Str(removed in Python 3.12+). Renovate builds the fork from source under Python 3.14, so any Renovate PR that regenerated a lockfile touching pypika failed to build.Upstream pypika has since revived (
v0.51.1) and fixed that. So we adopt upstream wholesale and re-apply the thing our fork added: ClickHouseSETTINGSclause support.The patch
ClickHouseQueryBuilder.settings(**kwargs)builder, plus SETTINGS serialization folded into upstream's existing_apply_paginationoverride (upstream now uses it forLIMIT BY), soSETTINGSemits afterLIMIT.Verification
Full suite green under Python 3.14 (upstream's
v0.51.1fixes theast.Strcrash):Clean, uncached wheel build under Python 3.14 now succeeds (this was the Renovate failure).
Tested against the memfault monorepo
Overlaid this build onto the monorepo's env (non-destructively) and ran the full pypika-touching data layer (~26 test files): 810 passed, 3 skipped, 4 failed.
SETTINGSrenders identically and both.settings(join_use_nulls=1)call sites pass.The 4 failures are all cosmetic and non-impactful: pypika
v0.51.1renders theNULLliteral lowercase (ELSE nullvsELSE NULL) in someCASEexpressions, which trips exact-string snapshot tests intest_device_vital_queries.py.null/NULLare case-insensitive in ClickHouse and Postgres, so the queries are functionally identical; we'll just regenerate those snapshots when re-pinning the monorepo.CI
Lintand the full unit-test matrix pass. The upstreamType Check(mypy) job is disabled in this fork (if: falseinci.yml): it is red on upstream's ownv0.51.1release commit.The plan after approval
Force-push
add-clickhouse-settings:master(masterbecomesv0.51.1+ this patch), then re-pin the memfault monorepo'spyproject.toml/uv.lockto that commit.Seeing the full force-push effect
This PR intentionally hides the upstream adoption. To see everything the force-push changes vs the current (old)
master:That diff is dominated by 3 years of upstream changes.