Skip to content

Commit e854829

Browse files
committed
Add suggestion
1 parent a165ba7 commit e854829

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pyiceberg/table/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,10 +1412,9 @@ def commit(self) -> None:
14121412
"""Apply the pending changes and commit."""
14131413
new_schema = self._apply()
14141414

1415-
existing_schema_id: Optional[int] = None
1416-
for schema in self._table.metadata.schemas:
1417-
if new_schema == schema:
1418-
existing_schema_id = schema.schema_id
1415+
existing_schema_id = existing_schema_id = next(
1416+
(schema.schema_id for schema in self._table.metadata.schemas if schema == new_schema), None
1417+
)
14191418

14201419
# Check if it is different current schema ID
14211420
if existing_schema_id != self._table.schema().schema_id:

0 commit comments

Comments
 (0)