Skip to content

Transaction

CommitProperties and PostCommitHookProperties

deltalake.CommitProperties dataclass

CommitProperties(custom_metadata: dict[str, str] | None = None, max_commit_retries: int | None = None, app_transactions: list[Transaction] | None = None)

The commit properties. Controls the behaviour of the commit.

Custom metadata to be stored in the commit. Controls the number of retries for the commit.

Parameters:

Name Type Description Default
custom_metadata dict[str, str] | None

custom metadata that will be added to the transaction commit.

None
max_commit_retries int | None

maximum number of times to retry the transaction commit.

None

deltalake.PostCommitHookProperties dataclass

PostCommitHookProperties(create_checkpoint: bool = True, cleanup_expired_logs: bool | None = None)

The post commit hook properties, only required for advanced usecases where you need to control this.

Checkpoints are by default created based on the delta.checkpointInterval config setting. cleanup_expired_logs can be set to override the delta.enableExpiredLogCleanup, otherwise the config setting will be used to decide whether to clean up logs automatically by taking also the delta.logRetentionDuration into account.

Parameters:

Name Type Description Default
create_checkpoint bool

to create checkpoints based on checkpoint interval. Defaults to True.

True
cleanup_expired_logs Optional[bool]

to clean up logs based on interval. Defaults to None.

None

Create write transactions

deltalake.transaction.AddAction dataclass

AddAction(path: str, size: int, partition_values: Mapping[str, str | None], modification_time: int, data_change: bool, stats: str)

deltalake.transaction.create_table_with_add_actions

create_table_with_add_actions(table_uri: str, schema: Schema, add_actions: list[AddAction], mode: Literal['error', 'append', 'overwrite', 'ignore'] = 'error', partition_by: list[str] | str | None = None, name: str | None = None, description: str | None = None, configuration: Mapping[str, str | None] | None = None, storage_options: dict[str, str] | None = None, commit_properties: CommitProperties | None = None, post_commithook_properties: PostCommitHookProperties | None = None) -> None

deltalake.DeltaTable.create_write_transaction

create_write_transaction(actions: list[AddAction], mode: str, schema: DeltaSchema | ArrowSchemaExportable, partition_by: list[str] | str | None = None, partition_filters: FilterType | None = None, commit_properties: CommitProperties | None = None, post_commithook_properties: PostCommitHookProperties | None = None) -> None