Skip to content

feat(builder): support UPDATE FROM builders and preserve DML CTEs - #779

Merged
cofin merged 17 commits into
mainfrom
flow/builder-dml-cte-update-from
Sep 13, 2026
Merged

cofin merged 17 commits into
mainfrom
flow/builder-dml-cte-update-from

Conversation

@cofin

@cofin cofin commented Sep 13, 2026

Copy link
Copy Markdown
Member

Adds query-builder and subquery sources to Update.from_() with bound-parameter merging, and preserves explicit CTEs on UPDATE and DELETE through with_cte()/with_(). Dialect checks retain supported UPDATE FROM forms, including BigQuery, and reject unsupported forms with SQLBuilderError, including Spanner PostgreSQL mode.

Adds the parameterized sql.values() factory and Values builder, with CTE bindings retained when queries are composed. Use sql.column("values") for a column with that name. Includes unit/integration regressions, documentation, and v0.63.0 release notes.

Validation: make lint passed during review. Regression tests were added or updated, but no local test suite was run in this review. Hosted CI for the latest branch head is still pending.

@cofin cofin changed the title feat(builder): allow builder sources in UPDATE FROM and render CTEs on UPDATE and DELETE feat(builder): support UPDATE FROM builders and preserve DML CTEs Sep 13, 2026
@codecov-commenter

codecov-commenter commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.97473% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.91%. Comparing base (1e36450) to head (17a6f2e).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
sqlspec/builder/_base.py 85.36% 3 Missing and 9 partials ⚠️
sqlspec/builder/_dml.py 87.23% 0 Missing and 6 partials ⚠️
sqlspec/builder/_values.py 95.38% 1 Missing and 5 partials ⚠️
sqlspec/builder/_select.py 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #779      +/-   ##
==========================================
+ Coverage   77.49%   78.91%   +1.41%     
==========================================
  Files         489      491       +2     
  Lines       72169    72437     +268     
  Branches    10128    10181      +53     
==========================================
+ Hits        55930    57163    +1233     
+ Misses      13050    11767    -1283     
- Partials     3189     3507     +318     
Flag Coverage Δ
integration 62.38% <45.12%> (+3.48%) ⬆️
py3.10 77.06% <90.97%> (+0.56%) ⬆️
py3.11 77.05% <90.97%> (+10.36%) ⬆️
py3.12 77.06% <90.97%> (+0.55%) ⬆️
py3.13 77.06% <90.97%> (+10.37%) ⬆️
py3.14 78.18% <90.94%> (+11.95%) ⬆️
unit 67.21% <90.97%> (+0.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sqlspec/builder/__init__.py 100.00% <100.00%> (ø)
sqlspec/builder/_factory.py 85.30% <100.00%> (+0.88%) ⬆️
sqlspec/data_dictionary/_types.py 92.41% <100.00%> (-0.17%) ⬇️
...qlspec/data_dictionary/dialects/bigquery/config.py 100.00% <ø> (ø)
...pec/data_dictionary/dialects/cockroachdb/config.py 100.00% <ø> (ø)
sqlspec/data_dictionary/dialects/duckdb/config.py 100.00% <ø> (ø)
sqlspec/data_dictionary/dialects/mssql/config.py 65.79% <ø> (-6.32%) ⬇️
sqlspec/data_dictionary/dialects/mysql/config.py 80.68% <ø> (-7.96%) ⬇️
sqlspec/data_dictionary/dialects/oracle/config.py 82.85% <100.00%> (-5.38%) ⬇️
...qlspec/data_dictionary/dialects/postgres/config.py 100.00% <ø> (ø)
... and 6 more

... and 70 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cofin
cofin force-pushed the flow/builder-dml-cte-update-from branch 2 times, most recently from c992a71 to c1ff0e8 Compare September 13, 2026 20:15
@cofin
cofin force-pushed the flow/builder-dml-cte-update-from branch from c1ff0e8 to 17a6f2e Compare September 13, 2026 20:19
@cofin
cofin merged commit 9c69704 into main Sep 13, 2026
1 check passed
@cofin
cofin deleted the flow/builder-dml-cte-update-from branch September 13, 2026 20:19
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.

2 participants