Fokko commented on code in PR #471:
URL: https://github.com/apache/iceberg-python/pull/471#discussion_r1503919299
##########
pyiceberg/table/__init__.py:
##########
@@ -219,68 +220,41 @@ def property_as_int(properties: Dict[str, str],
property_name: str, default: Opt
class Transaction:
_table: Table
+ _table_metadata: TableMetadata
+ _autocommit: bool
_updates: Tuple[TableUpdate, ...]
_requirements: Tuple[TableRequirement, ...]
- def __init__(
- self,
- table: Table,
- actions: Optional[Tuple[TableUpdate, ...]] = None,
- requirements: Optional[Tuple[TableRequirement, ...]] = None,
- ):
+ def __init__(self, table: Table, autocommit: bool = False):
self._table = table
- self._updates = actions or ()
- self._requirements = requirements or ()
+ self._table_metadata = table.metadata
+ self._autocommit = autocommit
Review Comment:
I was on the brink here :D, mostly since the Wikipedia page is also without
space: https://en.wikipedia.org/wiki/Autocommit
The auto-commit is currently not exposed to the user because on the table
itself the option is not exposed: `def transaction(self) -> Transaction:`. This
is only used when you do the shorthand:
```python
# This will create an autocommit transaction:
tbl.update_schema()
```
```python
# This one you need to commit yourself:
txn = tbl.transaction()
...
txn.commit()
```
I've added Pythondoc for clarification. Let me know if satisfies the need
for docs 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]