# Buggy code
def _get_table_input(
    database: str,
    table: str,
    boto3_session: Optional[boto3.Session],
    catalog_id: Optional[str] = None,
) -> Optional[Dict[str, str]]:
    client_glue: boto3.client = _utils.client(
        service_name="glue", session=boto3_session
    )
    args: Dict[str, str] = {}
    if catalog_id is not None:
        args["CatalogId"] = catalog_id  # pragma: no cover
    args["DatabaseName"] = database
    args["Name"] = table
    try:
        response: Dict[str, Any] = client_glue.get_table(**args)
    except client_glue.exceptions.EntityNotFoundException:
        return None
    if "DatabaseName" in response["Table"]:
        del response["Table"]["DatabaseName"]
    if "CreateTime" in response["Table"]:
        del response["Table"]["CreateTime"]
    if "UpdateTime" in response["Table"]:
        del response["Table"]["UpdateTime"]
    if "CreatedBy" in response["Table"]:
        del response["Table"]["CreatedBy"]
    if "IsRegisteredWithLakeFormation" in response["Table"]:
        del response["Table"]["IsRegisteredWithLakeFormation"]
    return response["Table"]


# Traceback (botocore.exceptions.ParamValidationError)
Traceback (most recent call last):
File "./src/upload_data_to_s3.py", line 88, in <module>
upload_local_files_to_dataset(full_refresh=False)
File "./src/upload_data_to_s3.py", line 83, in upload_local_files_to_dataset
partition_cols=['year'])
File "/home/circleci/project/venv/lib/python3.7/site-packages/awswrangler/s3.py", line 1217, in to_parquet
projection_digits=projection_digits,
File "/home/circleci/project/venv/lib/python3.7/site-packages/awswrangler/catalog.py", line 227, in create_parquet_table
projection_digits=projection_digits,
File "/home/circleci/project/venv/lib/python3.7/site-packages/awswrangler/catalog.py", line 1146, in _create_table
upsert_table_parameters(parameters=parameters, database=database, table=table, boto3_session=session)
File "/home/circleci/project/venv/lib/python3.7/site-packages/awswrangler/catalog.py", line 1660, in upsert_table_parameters
parameters=pars, database=database, table=table, catalog_id=catalog_id, boto3_session=session
File "/home/circleci/project/venv/lib/python3.7/site-packages/awswrangler/catalog.py", line 1715, in overwrite_table_parameters
client_glue.update_table(**args2)
File "/home/circleci/project/venv/lib/python3.7/site-packages/botocore/client.py", line 316, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/home/circleci/project/venv/lib/python3.7/site-packages/botocore/client.py", line 608, in _make_api_call
api_params, operation_model, context=request_context)
File "/home/circleci/project/venv/lib/python3.7/site-packages/botocore/client.py", line 656, in _convert_to_request_dict
api_params, operation_model)
File "/home/circleci/project/venv/lib/python3.7/site-packages/botocore/validate.py", line 297, in serialize_to_request
raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in TableInput: "CatalogId", must be one of: Name, Description, Owner, LastAccessTime, LastAnalyzedTime, Retention, StorageDescriptor, PartitionKeys, ViewOriginalText, ViewExpandedText, TableType, Parameters, TargetTable

# Fixed code
def _get_table_input(
    database: str,
    table: str,
    boto3_session: Optional[boto3.Session],
    catalog_id: Optional[str] = None,
) -> Optional[Dict[str, Any]]:
    client_glue: boto3.client = _utils.client(
        service_name="glue", session=boto3_session
    )
    args: Dict[str, str] = {}
    if catalog_id is not None:
        args["CatalogId"] = catalog_id  # pragma: no cover
    args["DatabaseName"] = database
    args["Name"] = table
    try:
        response: Dict[str, Any] = client_glue.get_table(**args)
    except client_glue.exceptions.EntityNotFoundException:
        return None

    table_input: Dict[str, Any] = {}
    for k, v in response["Table"].items():
        if k in [
            "Name",
            "Description",
            "Owner",
            "LastAccessTime",
            "LastAnalyzedTime",
            "Retention",
            "StorageDescriptor",
            "PartitionKeys",
            "ViewOriginalText",
            "ViewExpandedText",
            "TableType",
            "Parameters",
            "TargetTable",
        ]:
            table_input[k] = v

    return table_input