Skip to content
Draft
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
UpdateSchema does not respect transaction abort
  • Loading branch information
kevinjqliu committed Jan 8, 2025
commit c66dc0b195c25ac726c43c54fa642ec8cfd8a971
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