Skip to content
Open
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
10 changes: 0 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,6 @@ repos:
hooks:
- id: markdownlint
args: ["--fix"]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args:
[
"--ignore=D100,D102,D101,D103,D104,D107,D203,D212,D213,D404,D405,D406,D407,D411,D413,D415,D417",
]
additional_dependencies:
- tomli==2.0.1
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
Expand Down
1 change: 1 addition & 0 deletions pyiceberg/expressions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def eval(self, struct: StructProtocol) -> Any:

Args:
struct (StructProtocol): A row object that abides by the StructProtocol and returns values given a position.

Returns:
Any: The value at the referenced field's position in `struct`.
"""
Expand Down
1 change: 1 addition & 0 deletions pyiceberg/expressions/visitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ def visit_unbound_predicate(self, predicate: UnboundPredicate) -> T:

Args:
predicate (UnboundPredicate): An unbound predicate.

Raises:
TypeError: This always raises since an unbound predicate is not expected in a bound boolean expression.
"""
Expand Down
64 changes: 30 additions & 34 deletions pyiceberg/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,6 @@ def upsert(
"""Shorthand API for performing an upsert to an iceberg table.

Args:

df: The input dataframe to upsert with the table's data.
join_cols: Columns to join on, if not provided, it will use the identifier-field-ids.
when_matched_update_all: Bool indicating to update rows that are matched but require an update
Expand All @@ -866,26 +865,25 @@ def upsert(
branch: Branch Reference to run the upsert operation
snapshot_properties: Custom properties to be added to the snapshot summary

To learn more about the identifier-field-ids: https://iceberg.apache.org/spec/#identifier-field-ids

Example Use Cases:
Case 1: Both Parameters = True (Full Upsert)
Existing row found → Update it
New row found → Insert it
To learn more about the identifier-field-ids: https://iceberg.apache.org/spec/#identifier-field-ids

Case 2: when_matched_update_all = False, when_not_matched_insert_all = True
Existing row found → Do nothing (no updates)
New row found → Insert it
Example Use Cases:
Case 1: Both Parameters = True (Full Upsert)
Existing row found → Update it
New row found → Insert it

Case 3: when_matched_update_all = True, when_not_matched_insert_all = False
Existing row found → Update it
New row found → Do nothing (no inserts)
Case 2: when_matched_update_all = False, when_not_matched_insert_all = True
Existing row found → Do nothing (no updates)
New row found → Insert it

Case 4: Both Parameters = False (No Merge Effect)
Existing row found → Do nothing
New row found → Do nothing
(Function effectively does nothing)
Case 3: when_matched_update_all = True, when_not_matched_insert_all = False
Existing row found → Update it
New row found → Do nothing (no inserts)

Case 4: Both Parameters = False (No Merge Effect)
Existing row found → Do nothing
New row found → Do nothing
(Function effectively does nothing)

Returns:
An UpsertResult class (contains details of rows updated and inserted)
Expand Down Expand Up @@ -1660,7 +1658,6 @@ def upsert(
"""Shorthand API for performing an upsert to an iceberg table.

Args:

df: The input dataframe to upsert with the table's data.
join_cols: Columns to join on, if not provided, it will use the identifier-field-ids.
when_matched_update_all: Bool indicating to update rows that are matched but require an update
Expand All @@ -1671,26 +1668,25 @@ def upsert(
branch: Branch Reference to run the upsert operation
snapshot_properties: Custom properties to be added to the snapshot summary

To learn more about the identifier-field-ids: https://iceberg.apache.org/spec/#identifier-field-ids

Example Use Cases:
Case 1: Both Parameters = True (Full Upsert)
Existing row found → Update it
New row found → Insert it
To learn more about the identifier-field-ids: https://iceberg.apache.org/spec/#identifier-field-ids

Case 2: when_matched_update_all = False, when_not_matched_insert_all = True
Existing row found → Do nothing (no updates)
New row found → Insert it
Example Use Cases:
Case 1: Both Parameters = True (Full Upsert)
Existing row found → Update it
New row found → Insert it

Case 3: when_matched_update_all = True, when_not_matched_insert_all = False
Existing row found → Update it
New row found → Do nothing (no inserts)
Case 2: when_matched_update_all = False, when_not_matched_insert_all = True
Existing row found → Do nothing (no updates)
New row found → Insert it

Case 4: Both Parameters = False (No Merge Effect)
Existing row found → Do nothing
New row found → Do nothing
(Function effectively does nothing)
Case 3: when_matched_update_all = True, when_not_matched_insert_all = False
Existing row found → Update it
New row found → Do nothing (no inserts)

Case 4: Both Parameters = False (No Merge Effect)
Existing row found → Do nothing
New row found → Do nothing
(Function effectively does nothing)

Returns:
An UpsertResult class (contains details of rows updated and inserted)
Expand Down
5 changes: 4 additions & 1 deletion pyiceberg/table/update/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,8 @@ def _remove_ref_snapshot(self, ref_name: str) -> ManageSnapshots:
Args:
ref_name: branch / tag name to remove
Stages the updates and requirements for the remove-snapshot-ref.
Returns

Returns:
This method for chaining
"""
updates = (RemoveSnapshotRefUpdate(ref_name=ref_name),)
Expand Down Expand Up @@ -1381,6 +1382,7 @@ def by_id(self, snapshot_id: int) -> ExpireSnapshots:

Args:
snapshot_id (int): The ID of the snapshot to expire.

Returns:
This for method chaining.
"""
Expand All @@ -1402,6 +1404,7 @@ def by_ids(self, snapshot_ids: list[int]) -> ExpireSnapshots:

Args:
snapshot_ids (List[int]): List of snapshot IDs to expire.

Returns:
This for method chaining.
"""
Expand Down
2 changes: 1 addition & 1 deletion pyiceberg/table/update/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def _starting_sequence_number(table: Table, starting_snapshot: Snapshot) -> int:
table: Table to find snapshot from
starting_snapshot: Snapshot from where to start looking

Returns
Returns:
Sequence number as int
"""
if starting_snapshot is not None:
Expand Down
1 change: 1 addition & 0 deletions pyiceberg/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ class TruncateTransform(Transform[S, S]):

Args:
width (int): The truncate width, should be positive.

Raises:
ValueError: If a type is provided that is incompatible with a Truncate transform.
"""
Expand Down
2 changes: 2 additions & 0 deletions pyiceberg/utils/decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def decimal_to_bytes(value: Decimal, byte_length: int | None = None) -> bytes:
Args:
value (Decimal): a decimal value.
byte_length (int): The number of bytes.

Returns:
bytes: the unscaled value of the Decimal as bytes.
"""
Expand Down Expand Up @@ -105,6 +106,7 @@ def truncate_decimal(value: Decimal, width: int) -> Decimal:
Args:
value (Decimal): a decimal value.
width (int): A width for the returned Decimal instance.

Returns:
Decimal: A truncated Decimal instance.
"""
Expand Down
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,20 @@ select = [
"I", # isort
"UP", # pyupgrade
"T100", # flake8-debugger
"D", # pydocstyle
]
ignore = [
"D100", "D101", "D102", "D103", "D104", "D107",
"D203", "D212", "D213",
"D404", "D405", "D406", "D407", "D411", "D413", "D415", "D417",
]
ignore = []

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

per-file-ignores = {}
# pydocstyle skips test files by default (match = (?!test_).*\.py); mirror that for the D rules.
per-file-ignores = { "tests/**/test_*.py" = ["D"] }

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
Expand Down
Loading