Skip to content

Commit

Permalink
UpdateSchema does not respect transaction abort
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjqliu committed Jan 8, 2025
1 parent 3b58011 commit c66dc0b
Showing 1 changed file with 16 additions and 0 deletions.
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

0 comments on commit c66dc0b

Please sign in to comment.