Skip to content
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
26 changes: 26 additions & 0 deletions rerun_py/tests/e2e_redap_tests/test_table_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,29 @@ def test_create_table_from_dataset(prefilled_catalog: PrefilledCatalog, tmp_path
for returned_field in returned_schema:
original_field = original_schema.field(returned_field.name)
assert returned_field.metadata == original_field.metadata


def test_create_existing_table_fails(prefilled_catalog: PrefilledCatalog, tmp_path: pathlib.Path) -> None:
from .conftest import TABLE_FILEPATH

existing_table_name = "simple_datatypes"

_existing_table = prefilled_catalog.client.ctx.table(prefilled_catalog.factory.apply_prefix(existing_table_name))

schema = pa.schema([("int64", pa.int64()), ("float32", pa.float32()), ("utf8", pa.utf8())])

with pytest.raises(
Exception,
match="failed to create table",
):
_table_entry = prefilled_catalog.factory.create_table_entry(
existing_table_name, schema, tmp_path.absolute().as_uri()
)

existing_table_location = f"file://{TABLE_FILEPATH}"

with pytest.raises(
Exception,
match="failed to create table",
):
_table_entry = prefilled_catalog.factory.create_table_entry("new_table_name", schema, existing_table_location)