Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: set max_retries in CommitProperties #2826

Merged
merged 7 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/core/src/operations/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ impl CommitProperties {
self
}

/// Specify maximum number of times to retry the transaction before failing to commit
pub fn with_max_retries(mut self, max_retries: usize) -> Self {
self.max_retries = max_retries;
self
}

/// Specify if it should create a checkpoint when the commit interval condition is met
pub fn with_create_checkpoint(mut self, create_checkpoint: bool) -> Self {
self.create_checkpoint = create_checkpoint;
Expand Down
1 change: 1 addition & 0 deletions python/deltalake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from .table import (
ColumnProperties as ColumnProperties,
)
from .table import CommitProperties as CommitProperties
from .table import DeltaTable as DeltaTable
from .table import Metadata as Metadata
from .table import PostCommitHookProperties as PostCommitHookProperties
Expand Down
35 changes: 20 additions & 15 deletions python/deltalake/_internal.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ from typing import Any, Dict, List, Literal, Mapping, Optional, Tuple, Union
import pyarrow
import pyarrow.fs as fs

from deltalake.writer import AddAction, PostCommitHookProperties, WriterProperties
from deltalake.writer import (
AddAction,
CommitProperties,
PostCommitHookProperties,
WriterProperties,
)

__version__: str

Expand Down Expand Up @@ -57,7 +62,7 @@ class RawDeltaTable:
dry_run: bool,
retention_hours: Optional[int],
enforce_retention_duration: bool,
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
) -> List[str]: ...
def compact_optimize(
Expand All @@ -67,7 +72,7 @@ class RawDeltaTable:
max_concurrent_tasks: Optional[int],
min_commit_interval: Optional[int],
writer_properties: Optional[WriterProperties],
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
) -> str: ...
def z_order_optimize(
Expand All @@ -79,40 +84,40 @@ class RawDeltaTable:
max_spill_size: Optional[int],
min_commit_interval: Optional[int],
writer_properties: Optional[WriterProperties],
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
) -> str: ...
def add_columns(
self,
fields: List[Field],
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
) -> None: ...
def add_constraints(
self,
constraints: Dict[str, str],
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
) -> None: ...
def drop_constraints(
self,
name: str,
raise_if_not_exists: bool,
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
) -> None: ...
def set_table_properties(
self,
properties: Dict[str, str],
raise_if_not_exists: bool,
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
) -> None: ...
def restore(
self,
target: Optional[Any],
ignore_missing_files: bool,
protocol_downgrade_allowed: bool,
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
) -> str: ...
def history(self, limit: Optional[int]) -> List[str]: ...
def update_incremental(self) -> None: ...
Expand All @@ -125,13 +130,13 @@ class RawDeltaTable:
self,
predicate: Optional[str],
writer_properties: Optional[WriterProperties],
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
) -> str: ...
def repair(
self,
dry_run: bool,
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
) -> str: ...
def update(
Expand All @@ -140,7 +145,7 @@ class RawDeltaTable:
predicate: Optional[str],
writer_properties: Optional[WriterProperties],
safe_cast: bool,
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
) -> str: ...
def create_merge_builder(
Expand All @@ -150,7 +155,7 @@ class RawDeltaTable:
source_alias: Optional[str],
target_alias: Optional[str],
writer_properties: Optional[WriterProperties],
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
safe_cast: bool,
) -> PyMergeBuilder: ...
Expand All @@ -165,7 +170,7 @@ class RawDeltaTable:
partition_by: List[str],
schema: pyarrow.Schema,
partitions_filters: Optional[FilterType],
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
) -> None: ...
def cleanup_metadata(self) -> None: ...
Expand Down Expand Up @@ -206,7 +211,7 @@ def write_to_deltalake(
configuration: Optional[Mapping[str, Optional[str]]],
storage_options: Optional[Dict[str, str]],
writer_properties: Optional[WriterProperties],
custom_metadata: Optional[Dict[str, str]],
commit_properties: Optional[CommitProperties],
post_commithook_properties: Optional[PostCommitHookProperties],
) -> None: ...
def convert_to_deltalake(
Expand Down
Loading
Loading