import sqlite3


def get_table_gpkg_contents_information(gpkg, table_name):
    """

    :param gpkg: Path to geopackage file.
    :param table_name: A table name to look up in gpkg_contents.
    :return: A dict with the column names as the keys.
    """
    with sqlite3.connect(gpkg) as conn:
        result = conn.execute(
            "SELECT table_name, data_type, identifier, description, last_change, min_x, min_y, max_x, max_y, srs_id "
            "FROM gpkg_contents WHERE table_name = '{0}';".format(table_name)
        )
        table_information = result.fetchone()
        return {
            "table_name": table_information[0],
            "data_type": table_information[1],
            "identifier": table_information[2],
            "description": table_information[3],
            "last_change": table_information[4],
            "min_x": table_information[5],
            "min_y": table_information[6],
            "max_x": table_information[7],
            "max_y": table_information[8],
            "srs_id": table_information[9],
        }