Skip to content
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

UpdateSchema does not respect transaction abort #1497

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions tests/integration/test_rest_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,22 @@ def test_add_already_exists(catalog: Catalog, table_schema_nested: Schema) -> No
assert "already exists: location.latitude" in str(exc_info.value)


# @pytest.mark.integration
def test_abort_transaction(catalog: Catalog, table_schema_nested: Schema) -> None:
table = _create_table_with_schema(catalog, table_schema_nested)
old_schema = table.schema()

with pytest.raises(ValueError) as exc_info:
with table.update_schema() as update:
update.add_column("123", IntegerType()) # "123" can be added succesfully
update.add_column("foo", IntegerType())
assert "already exists: foo" in str(exc_info.value)
# transaction raised, but "123" column is still added
print(f"Original Schema: {old_schema}")
print(f"New Schema: {table.schema()}")
assert old_schema == table.schema()


@pytest.mark.integration
def test_add_to_non_struct_type(catalog: Catalog, table_schema_simple: Schema) -> None:
table = _create_table_with_schema(catalog, table_schema_simple)
Expand Down
Loading