Commit b31b762
authored
fix(table): avoid committing update builders after exceptions (#3354)
## Summary
Avoid committing update builders when the body of a `with` block raises.
`UpdateTableMetadata.__exit__` currently commits unconditionally, so
user code like `with table.update_schema() as update:` can still mutate
table metadata even when an exception is raised before the block
finishes. This change makes update builders mirror
`Transaction.__exit__` and only commit on a clean exit.
## Testing
- `.venv\\Scripts\\python -m pytest
"tests/catalog/test_catalog_behaviors.py::test_update_schema_with_statement_does_not_commit_on_exception[memory]"
"tests/catalog/test_catalog_behaviors.py::test_update_schema_with_statement_does_not_commit_on_exception[sql]"
-q`1 parent 739373f commit b31b762
2 files changed
Lines changed: 25 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
942 | 942 | | |
943 | 943 | | |
944 | 944 | | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
945 | 965 | | |
946 | 966 | | |
947 | 967 | | |
| |||
0 commit comments