Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 10 additions & 2 deletions pyiceberg/catalog/glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,20 @@


def _construct_parameters(
metadata_location: str, glue_table: Optional["TableTypeDef"] = None, prev_metadata_location: Optional[str] = None
metadata_location: str,
glue_table: Optional["TableTypeDef"] = None,
prev_metadata_location: Optional[str] = None,
metadata_properties: Optional[Properties] = None,
) -> Properties:
new_parameters = glue_table.get("Parameters", {}) if glue_table else {}
new_parameters.update({TABLE_TYPE: ICEBERG.upper(), METADATA_LOCATION: metadata_location})
if prev_metadata_location:
new_parameters[PREVIOUS_METADATA_LOCATION] = prev_metadata_location

if metadata_properties:
for key, value in metadata_properties.items():
new_parameters[key] = str(value)

return new_parameters


Expand Down Expand Up @@ -236,7 +244,7 @@ def _construct_table_input(
table_input: "TableInputTypeDef" = {
"Name": table_name,
"TableType": EXTERNAL_TABLE,
"Parameters": _construct_parameters(metadata_location, glue_table, prev_metadata_location),
"Parameters": _construct_parameters(metadata_location, glue_table, prev_metadata_location, properties),
"StorageDescriptor": {
"Columns": _to_columns(metadata),
"Location": metadata.location,
Expand Down
2 changes: 2 additions & 0 deletions tests/catalog/test_glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,8 @@ def test_commit_table_properties(
Name=table_name,
)
assert table_info["Table"]["Description"] == "test_description"
assert table_info["Table"]["Parameters"]["test_a"] == "test_aa"
assert table_info["Table"]["Parameters"]["test_c"] == "test_c"


@mock_aws
Expand Down