Skip to content

Commit 4e4936b

Browse files
committed
Added necesary parameters to 'to_iceberg' method to expand functionality
1 parent e939741 commit 4e4936b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

awswrangler/athena/_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343

4444
_logger: logging.Logger = logging.getLogger(__name__)
4545

46+
class _MergeClause(TypedDict, total=False):
47+
when: Literal["MATCHED", "NOT_MATCHED", "NOT_MATCHED_BY_SOURCE"]
48+
condition: str | None
49+
action: Literal["UPDATE", "DELETE", "INSERT"]
50+
columns: list[str] | None
4651

4752
class _QueryMetadata(NamedTuple):
4853
execution_id: str
@@ -63,7 +68,6 @@ class _WorkGroupConfig(NamedTuple):
6368
encryption: str | None
6469
kms_key: str | None
6570

66-
6771
def _get_s3_output(
6872
s3_output: str | None, wg_config: _WorkGroupConfig, boto3_session: boto3.Session | None = None
6973
) -> str:

awswrangler/athena/_write_iceberg.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import re
77
import typing
88
import uuid
9-
from typing import Any, Dict, Literal, TypedDict
9+
from typing import Any, Dict, Literal, TypedDict, Union
1010

1111
import boto3
1212
import pandas as pd
@@ -18,6 +18,7 @@
1818
_get_workgroup_config,
1919
_start_query_execution,
2020
_WorkGroupConfig,
21+
_MergeClause
2122
)
2223
from awswrangler.typing import GlueTableSettings
2324

@@ -361,7 +362,9 @@ def to_iceberg( # noqa: PLR0913
361362
table_location: str | None = None,
362363
partition_cols: list[str] | None = None,
363364
merge_cols: list[str] | None = None,
364-
merge_condition: Literal["update", "ignore"] = "update",
365+
merge_on_condition: str | None = None,
366+
merge_condition: Literal["update", "ignore", "conditional_merge"] = "update",
367+
merge_conditional_clauses: list[_MergeClause] | None = None,
365368
merge_match_nulls: bool = False,
366369
keep_files: bool = True,
367370
data_source: str | None = None,

0 commit comments

Comments
 (0)