in pyiceberg/catalog/glue.py [0:0]
def _convert_glue_to_iceberg(self, glue_table: TableTypeDef) -> Table:
properties: Properties = glue_table["Parameters"]
assert glue_table["DatabaseName"]
assert glue_table["Parameters"]
database_name = glue_table["DatabaseName"]
table_name = glue_table["Name"]
if TABLE_TYPE not in properties:
raise NoSuchPropertyException(
f"Property {TABLE_TYPE} missing, could not determine type: {database_name}.{table_name}"
)
glue_table_type = properties[TABLE_TYPE]
if glue_table_type.lower() != ICEBERG:
raise NoSuchIcebergTableError(
f"Property table_type is {glue_table_type}, expected {ICEBERG}: {database_name}.{table_name}"
)
if METADATA_LOCATION not in properties:
raise NoSuchPropertyException(
f"Table property {METADATA_LOCATION} is missing, cannot find metadata for: {database_name}.{table_name}"
)
metadata_location = properties[METADATA_LOCATION]
io = self._load_file_io(location=metadata_location)
file = io.new_input(metadata_location)
metadata = FromInputFile.table_metadata(file)
return Table(
identifier=(database_name, table_name),
metadata=metadata,
metadata_location=metadata_location,
io=self._load_file_io(metadata.properties, metadata_location),
catalog=self,
)