@@ -275,13 +275,20 @@ def __exit__(self, exctype: type[BaseException] | None, excinst: BaseException |
275275 if exctype is None and excinst is None and exctb is None :
276276 self .commit_transaction ()
277277
278- def _apply (
278+ def _stage (
279279 self ,
280280 updates : tuple [TableUpdate , ...],
281281 requirements : tuple [TableRequirement , ...] = (),
282- commit_transaction_if_autocommit : bool = True ,
283282 ) -> Transaction :
284- """Check if the requirements are met, and applies the updates to the metadata."""
283+ """Stage updates to the transaction state without committing to the catalog.
284+
285+ Args:
286+ updates: The updates to stage.
287+ requirements: The requirements that must be met.
288+
289+ Returns:
290+ This transaction for method chaining.
291+ """
285292 for requirement in requirements :
286293 requirement .validate (self .table_metadata )
287294
@@ -294,7 +301,17 @@ def _apply(
294301 if type (new_requirement ) not in existing_requirements :
295302 self ._requirements = self ._requirements + (new_requirement ,)
296303
297- if self ._autocommit and commit_transaction_if_autocommit :
304+ return self
305+
306+ def _apply (
307+ self ,
308+ updates : tuple [TableUpdate , ...],
309+ requirements : tuple [TableRequirement , ...] = (),
310+ ) -> Transaction :
311+ """Check if the requirements are met, and applies the updates to the metadata."""
312+ self ._stage (updates , requirements )
313+
314+ if self ._autocommit :
298315 self .commit_transaction ()
299316
300317 return self
0 commit comments