Get an existing continuous query.

    database
        Name of the database for which the continuous query was
        defined.

    name
        Name of the continuous query to get.

    CLI Example:

    .. code-block:: bash

        salt '*' influxdb.get_continuous_query mydb cq_month

def get_continuous_query(database, name, **client_args):
    '''
    Get an existing continuous query.

    database
        Name of the database for which the continuous query was
        defined.

    name
        Name of the continuous query to get.

    CLI Example:

    .. code-block:: bash

        salt '*' influxdb.get_continuous_query mydb cq_month
    '''
    client = _client(**client_args)

    try:
        for db, cqs in client.query('SHOW CONTINUOUS QUERIES').items():
            if db[0] == database:
                return next((cq for cq in cqs if cq.get('name') == name))
    except StopIteration:
        return {}
    return {}