# Buggy code
def format_table_metadata(self, record) -> metadata_model_whale.TableMetadata:
    block_template = textwrap.dedent(
        """            # `{schema}.{name}`{view_statement}
            `{database}`{cluster_statement}
            {description}
            {column_details_delimiter}
            {columns}
            """
    )

    formatted_columns = self.format_columns(record)

    if record.description:
        if type(record.description) == DescriptionMetadata:
            description = record.description._text + "\n"
        else:
            description = str(record.description) + "\n"
    else:
        description = ""

    if record.cluster == "None":  # edge case for Hive Metastore
        cluster = None
    else:
        cluster = record.cluster

    if cluster is not None:
        cluster_statement = f"| `{cluster}`"
    else:
        cluster_statement = ""

    markdown_blob = block_template.format(
        schema=record.schema,
        name=record.name,
        view_statement=" [view]" if record.is_view else "",
        database=record.database,
        cluster_statement=cluster_statement,
        description=description,
        column_details_delimiter=COLUMN_DETAILS_DELIMITER,
        columns=formatted_columns,
    )

    return metadata_model_whale.TableMetadata(
        database=record.database,
        cluster=record.cluster,
        schema=record.schema,
        name=record.name,
        markdown_blob=markdown_blob,
    )


# Traceback (IndexError)
Traceback (most recent call last):
File "/usr/local/Cellar/whale/v1.1.4/bin/../libexec/build_script.py", line 23, in <module>
pull()
File "/usr/local/Cellar/whale/v1.1.4/libexec/env/lib/python3.8/site-packages/whale/utils/task_wrappers.py", line 113, in pull
task.run()
File "/usr/local/Cellar/whale/v1.1.4/libexec/env/lib/python3.8/site-packages/whale/task/__init__.py", line 23, in run
record = self.extractor.extract()
File "/usr/local/Cellar/whale/v1.1.4/libexec/env/lib/python3.8/site-packages/whale/extractor/glue_extractor.py", line 28, in extract
return next(self._extract_iter)
File "/usr/local/Cellar/whale/v1.1.4/libexec/env/lib/python3.8/site-packages/whale/extractor/glue_extractor.py", line 52, in _get_extract_iter
catalog, schema, table = self._parse_location(
File "/usr/local/Cellar/whale/v1.1.4/libexec/env/lib/python3.8/site-packages/whale/extractor/glue_extractor.py", line 91, in _parse_location
table = splits[-1]
IndexError: list index out of range

# Fixed code
def format_table_metadata(self, record) -> metadata_model_whale.TableMetadata:
    block_template = textwrap.dedent(
        """            # `{schema_statement}{name}`{view_statement}
            `{database}`{cluster_statement}
            {description}
            {column_details_delimiter}
            {columns}
            """
    )

    formatted_columns = self.format_columns(record)

    if record.description:
        if type(record.description) == DescriptionMetadata:
            description = record.description._text + "\n"
        else:
            description = str(record.description) + "\n"
    else:
        description = ""

    if record.cluster == "None":  # edge case for Hive Metastore
        cluster = None
    else:
        cluster = record.cluster

    if cluster is not None:
        cluster_statement = f" | `{cluster}`"
    else:
        cluster_statement = ""

    if (
        record.schema == None
    ):  # edge case for Glue, which puts everything in record.table
        schema_statement = ""
    else:
        schema_statement = f"{record.schema}."

    markdown_blob = block_template.format(
        schema_statement=schema_statement,
        name=record.name,
        view_statement=" [view]" if record.is_view else "",
        database=record.database,
        cluster_statement=cluster_statement,
        description=description,
        column_details_delimiter=COLUMN_DETAILS_DELIMITER,
        columns=formatted_columns,
    )

    return metadata_model_whale.TableMetadata(
        database=record.database,
        cluster=record.cluster,
        schema=record.schema,
        name=record.name,
        markdown_blob=markdown_blob,
    )