def build_key_hierarchy(key):
    """Build a list with key in it and all of it's parent keys.

    :param key: (str) A dotted path.
    :returns [str]: A list of keys.
    """
    all_keys = [key]
    try:
        while True:
            key = key[:key.rindex('.')]
            all_keys.append(key)
    except ValueError:
        pass
    return all_keys
