-
Notifications
You must be signed in to change notification settings - Fork 199
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
[discuss] Transaction
API's autocommit
#1253
Comments
instead of another with..transaction wrapper
.... What about moving the For example, Currently, these classes use
|
Just raise another possibility for discussion. We could also modify the class UpdateSchema(UpdateTableMetadata["UpdateSchema"]):
...
def __enter__(self):
self._transaction._autocommit = False
return self
... The reason behind my head is, to my understanding, autocommit is still somewhat a related concept with transaction. |
Adding an example for the issue: from pyiceberg.catalog.sql import SqlCatalog
from pyiceberg.schema import Schema
from pyiceberg.types import IntegerType, NestedField, StringType
WAREHOUSE_PATH = "/tmp/warehouse"
catalog = SqlCatalog(
"default",
uri=f"sqlite:///{WAREHOUSE_PATH}/pyiceberg_catalog.db", warehouse=f"file://{WAREHOUSE_PATH}",
)
catalog.create_namespace_if_not_exists("default")
try:
catalog.drop_table("default.test")
except:
pass
schema = Schema(
NestedField(1, "field1", StringType(), required=False)
)
table = catalog.create_table("default.test", schema)
with table.update_schema() as update:
update.add_column("field_should_not_exist", IntegerType()) # <--- This field should not be committed
raise Exception("Error!") |
I think its fair to ask if we consider
I feel like in this case, we can just get rid of |
Porting over from #1246
Can be a potential footgun (#1246 (comment))
Autocommit usage (#1246 (comment))
The text was updated successfully, but these errors were encountered: