Skip to content

Refresh source fields by model attribute name - #2335

Merged
waketzheng merged 5 commits into
tortoise:developfrom
IlyaKhalafi:fix/refresh-source-fields
Oct 23, 2026
Merged

waketzheng merged 5 commits into
tortoise:developfrom
IlyaKhalafi:fix/refresh-source-fields

Conversation

@IlyaKhalafi

Copy link
Copy Markdown
Contributor

Description

This PR fixes refresh_from_db() leaving renamed fields stale. With this, full refreshes use model attribute names and update renamed fields and foreign-key IDs correctly.

Motivation and Context

Fixes #2334.

How Has This Been Tested?

make check and 160 focused tests passed. The full SQLite suite passed with 1,984 tests, 149 skips and two expected failures. Four new regression cases fail on the unchanged baseline. PostgreSQL and MySQL were not tested live.

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.

@codspeed

codspeed Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 21 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 24 untouched benchmarks


Comparing IlyaKhalafi:fix/refresh-source-fields (7b85b3f) with develop (b237e06)

Open in CodSpeed

@waketzheng
waketzheng merged commit 925c2c6 into tortoise:develop Oct 23, 2026
25 checks passed
d3vyce pushed a commit to d3vyce/tortoise-orm that referenced this pull request Oct 24, 2026
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.

Full refresh_from_db leaves source_field attributes stale

2 participants