rustyconover commented on code in PR #8304:
URL: https://github.com/apache/iceberg/pull/8304#discussion_r1315217185


##########
python/pyiceberg/catalog/glue.py:
##########
@@ -56,124 +64,109 @@
 from pyiceberg.table.sorting import UNSORTED_SORT_ORDER, SortOrder
 from pyiceberg.typedef import EMPTY_DICT
 
-BOTO_SESSION_CONFIG_KEYS = ["aws_access_key_id", "aws_secret_access_key", 
"aws_session_token", "region_name", "profile_name"]
-
-GLUE_CLIENT = "glue"
-
-
-PROP_GLUE_TABLE = "Table"
-PROP_GLUE_TABLE_TYPE = "TableType"
-PROP_GLUE_TABLE_DESCRIPTION = "Description"
-PROP_GLUE_TABLE_PARAMETERS = "Parameters"
-PROP_GLUE_TABLE_DATABASE_NAME = "DatabaseName"
-PROP_GLUE_TABLE_NAME = "Name"
-PROP_GLUE_TABLE_OWNER = "Owner"
-PROP_GLUE_TABLE_STORAGE_DESCRIPTOR = "StorageDescriptor"
-
-PROP_GLUE_TABLELIST = "TableList"
-
-PROP_GLUE_DATABASE = "Database"
-PROP_GLUE_DATABASE_LIST = "DatabaseList"
-PROP_GLUE_DATABASE_NAME = "Name"
-PROP_GLUE_DATABASE_LOCATION = "LocationUri"
-PROP_GLUE_DATABASE_DESCRIPTION = "Description"
-PROP_GLUE_DATABASE_PARAMETERS = "Parameters"
-
-PROP_GLUE_NEXT_TOKEN = "NextToken"
-
-GLUE_DESCRIPTION_KEY = "comment"
-
 
 def _construct_parameters(metadata_location: str) -> Properties:
     return {TABLE_TYPE: ICEBERG.upper(), METADATA_LOCATION: metadata_location}
 
 
-def _construct_create_table_input(table_name: str, metadata_location: str, 
properties: Properties) -> Dict[str, Any]:
-    table_input = {
-        PROP_GLUE_TABLE_NAME: table_name,
-        PROP_GLUE_TABLE_TYPE: EXTERNAL_TABLE,
-        PROP_GLUE_TABLE_PARAMETERS: _construct_parameters(metadata_location),
+def _construct_create_table_input(table_name: str, metadata_location: str, 
properties: Properties) -> TableInputTypeDef:
+    table_input: TableInputTypeDef = {
+        "Name": table_name,
+        "TableType": EXTERNAL_TABLE,
+        "Parameters": _construct_parameters(metadata_location),
     }
 
-    if table_description := properties.get(GLUE_DESCRIPTION_KEY):
-        table_input[PROP_GLUE_TABLE_DESCRIPTION] = table_description
+    if "Description" in properties:
+        table_input["Description"] = properties["Description"]
 
     return table_input
 
 
-def _construct_rename_table_input(to_table_name: str, glue_table: Dict[str, 
Any]) -> Dict[str, Any]:
-    rename_table_input = {PROP_GLUE_TABLE_NAME: to_table_name}
+def _construct_rename_table_input(to_table_name: str, glue_table: 
TableTypeDef) -> TableInputTypeDef:
+    rename_table_input: TableInputTypeDef = {"Name": to_table_name}
     # use the same Glue info to create the new table, pointing to the old 
metadata
-    if table_type := glue_table.get(PROP_GLUE_TABLE_TYPE):
-        rename_table_input[PROP_GLUE_TABLE_TYPE] = table_type
-    if table_parameters := glue_table.get(PROP_GLUE_TABLE_PARAMETERS):
-        rename_table_input[PROP_GLUE_TABLE_PARAMETERS] = table_parameters
-    if table_owner := glue_table.get(PROP_GLUE_TABLE_OWNER):
-        rename_table_input[PROP_GLUE_TABLE_OWNER] = table_owner
-    if table_storage_descriptor := 
glue_table.get(PROP_GLUE_TABLE_STORAGE_DESCRIPTOR):
-        rename_table_input[PROP_GLUE_TABLE_STORAGE_DESCRIPTOR] = 
table_storage_descriptor
-    if table_description := glue_table.get(PROP_GLUE_TABLE_DESCRIPTION):
-        rename_table_input[PROP_GLUE_TABLE_DESCRIPTION] = table_description
+    rename_table_input["TableType"] = glue_table["TableType"]

Review Comment:
   I've added an assert check, all Iceberg tables will have a TableType 
defined.  Glue supports may different types of tables, but since we're mostly 
consuming Iceberg we can set some assertions which will inform mypy.



-- 
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]

Reply via email to