def get_table_schema(conn, table):
    """Get column name and type of given table

    Args:
        conn: a database connection, this function will leave it open
        table: table name or db.table

    Returns:
        Tuple of (field_name, field_type) tuples
    """
    if conn.driver == "maxcompute":
        schema = conn.get_table(table).schema
        names_and_types = [(c.name, str(c.type).upper())
                           for c in schema.columns]
        return names_and_types
    else:
        statement = "describe %s" % table
        cursor = conn.cursor()
        cursor.execute(statement)
        fields = []
        for field in cursor:
            # add field name and type
            fields.append((field[0], field[1].upper()))
        cursor.close()
    return fields