-
Notifications
You must be signed in to change notification settings - Fork 585
Add e2e test for creating a table that already exists #12037
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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, entry_factory: EntryFactory, tmp_path: pathlib.Path | ||
|
||
| ) -> 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) | ||
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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.