Skip to content
Open
Changes from 1 commit
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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc you're going to have to mark this one as creates_table, otherwise it'll break DPF ci.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? It doesn't actually create any tables.

prefilled_catalog: PrefilledCatalog, entry_factory: EntryFactory, tmp_path: pathlib.Path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefilled_catalog already contains an EntryFactory, so you can use prefilled_catalog.factory instead of having the explicit fixture.

Also, not necessary for this PR, but EntryFactory could have introspection APIs to list entries created so far. Could be occasionally convenient, eg when you want to trigger a collision like in this test.

) -> None:
from .conftest import TABLE_FILEPATH

existing_table_name = "simple_datatypes"

_existing_table = prefilled_catalog.client.ctx.table(entry_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 = entry_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 = entry_factory.create_table_entry("new_table_name", schema, existing_table_location)
Loading