in awswrangler/catalog/_create.py [0:0]
def _update_table_input(table_input: dict[str, Any], columns_types: dict[str, str], allow_reorder: bool = True) -> bool:
column_updated = False
catalog_cols: dict[str, str] = {x["Name"]: x["Type"] for x in table_input["StorageDescriptor"]["Columns"]}
if not allow_reorder:
for catalog_key, frame_key in zip(catalog_cols, columns_types):
if catalog_key != frame_key:
raise exceptions.InvalidArgumentValue(f"Column {frame_key} is out of order.")
for c, t in columns_types.items():
if c not in catalog_cols:
_logger.debug("New column %s with type %s.", c, t)
table_input["StorageDescriptor"]["Columns"].append({"Name": c, "Type": t})
column_updated = True
elif t != catalog_cols[c]: # Data type change detected!
raise exceptions.InvalidArgumentValue(
f"Data type change detected on column {c} (Old type: {catalog_cols[c]} / New type {t})."
)
return column_updated