HonahX commented on code in PR #711:
URL: https://github.com/apache/iceberg-python/pull/711#discussion_r1608637860
##########
tests/catalog/integration_test_glue.py:
##########
@@ -564,3 +564,13 @@ def test_table_exists(test_catalog: Catalog,
table_schema_nested: Schema, table_
test_catalog.create_namespace(database_name)
test_catalog.create_table((database_name, table_name), table_schema_nested)
assert test_catalog.table_exists((database_name, table_name)) is True
+
+
+def test_register_table(test_catalog: Catalog, metadata_location: str,
table_name: str, database_name: str) -> None:
Review Comment:
`metadata_location` is a fixture that simulate an example metadata file
stored in a temp location. Since it is an integration test, shall we register a
table using a real metadata file stored in a bucket?
We could first create an iceberg table, record its `metadata_location`, and
then drop it. The `drop_table` operation will not purge the actual metadata
file. Then we could test `register_table` using that metadata file and a new
table name, for example:
```python
def test_register_table(test_catalog: Catalog, table_schema_nested: Schema,
table_name: str, database_name: str) -> None:
identifier = (database_name, table_name)
new_identifier = (database_name, f"new_{table_name}")
test_catalog.create_namespace(database_name)
tbl = test_catalog.create_table(identifier, table_schema_nested)
location = tbl.metadata_location
# drops the table but keeps the metadata file
test_catalog.drop_table(identifier)
assert not test_catalog.table_exists(identifier)
table = test_catalog.register_table(new_identifier, location)
assert table.identifier == (CATALOG_NAME,) + new_identifier
assert table.metadata_location == location
assert test_catalog.table_exists(new_identifier)
```
WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]