prefect.transactions
Functions
get_transaction
transaction
- key
: An identifier to use for the transaction- store
: The store to use for persisting the transaction result. If not provided, a default store will be used based on the current run context.- commit_mode
: The commit mode controlling when the transaction and child transactions are committed- overwrite
: Whether to overwrite an existing transaction record in the store- write_on_commit
: Whether to write the result to the store on commit. If not provided, will default will be determined by the current run context. If no run context is available, the value ofPREFECT_RESULTS_PERSIST_BY_DEFAULT
will be used.
atransaction
- key
: An identifier to use for the transaction- store
: The store to use for persisting the transaction result. If not provided, a default store will be used based on the current run context.- commit_mode
: The commit mode controlling when the transaction and child transactions are committed- overwrite
: Whether to overwrite an existing transaction record in the store- write_on_commit
: Whether to write the result to the store on commit. If not provided, the default will be determined by the current run context. If no run context is available, the value ofPREFECT_RESULTS_PERSIST_BY_DEFAULT
will be used.
Classes
IsolationLevel
Methods:
auto
enum.auto()
to avoid requiring a second import to use AutoEnum
CommitMode
Methods:
auto
enum.auto()
to avoid requiring a second import to use AutoEnum
TransactionState
Methods:
auto
enum.auto()
to avoid requiring a second import to use AutoEnum
BaseTransaction
A base model for transaction state.
Methods:
add_child
get
set
method.
Args:
name
: The name of the value to getdefault
: The default value to return if the value is not found
- The value from the transaction
get
get_active
get_parent
is_active
is_committed
is_pending
is_rolled_back
is_staged
model_copy
- A new model instance.
prepare_transaction
serialize
set
name
: The name of the value to setvalue
: The value to set
stage
Transaction
A model representing the state of a transaction.
Methods:
add_child
begin
commit
get
set
method.
Args:
name
: The name of the value to getdefault
: The default value to return if the value is not found
- The value from the transaction
get_active
get_parent
is_active
is_committed
is_pending
is_rolled_back
is_staged
prepare_transaction
read
reset
rollback
run_hook
set
name
: The name of the value to setvalue
: The value to set
stage
AsyncTransaction
A model representing the state of an asynchronous transaction.
Methods:
add_child
begin
commit
get
set
method.
Args:
name
: The name of the value to getdefault
: The default value to return if the value is not found
- The value from the transaction
get_active
get_parent
is_active
is_committed
is_pending
is_rolled_back
is_staged
prepare_transaction
read
reset
rollback
run_hook
set
name
: The name of the value to setvalue
: The value to set