def render_query(dataset, tables, select=None, conditions=None,
                 groupings=None, having=None, order_by=None, limit=None):
    """Render a query that will run over the given tables using the specified
    parameters.

    Parameters
    ----------
    dataset : str
        The BigQuery dataset to query data from
    tables : Union[dict, list]
        The table in `dataset` to query.
    select : dict, optional
        The keys function as column names and the values function as options to
        apply to the select field such as alias and format.  For example,
        select['start_time'] might have the form
        {'alias': 'StartTime', 'format': 'INTEGER-FORMAT_UTC_USEC'}, which
        would be represented as 'SEC_TO_TIMESTAMP(INTEGER(start_time)) as
        StartTime' in a query. Pass `None` to select all.
    conditions : list, optional
        a ``list`` of ``dict`` objects to filter results by.  Each dict should
        have the keys 'field', 'type', and 'comparators'. The first two map to
        strings representing the field (e.g. 'foo') and type (e.g. 'FLOAT').
        'comparators' maps to another ``dict`` containing the keys 'condition',
        'negate', and 'value'.
        If 'comparators' = {'condition': '>=', 'negate': False, 'value': 1},
        this example will be rendered as 'foo >= FLOAT('1')' in the query.
        ``list`` of field names to group by
    order_by : dict, optional
        Keys = {'field', 'direction'}. `dict` should be formatted as
        {'field':'TimeStamp, 'direction':'desc'} or similar
    limit : int, optional
        Limit the amount of data needed to be returned.

    Returns
    -------
    str
        A rendered query
    """

    if None in (dataset, tables):
        return None

    query = "%s %s %s %s %s %s %s" % (
        _render_select(select),
        _render_sources(dataset, tables),
        _render_conditions(conditions),
        _render_groupings(groupings),
        _render_having(having),
        _render_order(order_by),
        _render_limit(limit)
    )

    return query
Render a query that will run over the given tables using the specified
    parameters.

    Parameters
    ----------
    dataset : str
        The BigQuery dataset to query data from
    tables : Union[dict, list]
        The table in `dataset` to query.
    select : dict, optional
        The keys function as column names and the values function as options to
        apply to the select field such as alias and format.  For example,
        select['start_time'] might have the form
        {'alias': 'StartTime', 'format': 'INTEGER-FORMAT_UTC_USEC'}, which
        would be represented as 'SEC_TO_TIMESTAMP(INTEGER(start_time)) as
        StartTime' in a query. Pass `None` to select all.
    conditions : list, optional
        a ``list`` of ``dict`` objects to filter results by.  Each dict should
        have the keys 'field', 'type', and 'comparators'. The first two map to
        strings representing the field (e.g. 'foo') and type (e.g. 'FLOAT').
        'comparators' maps to another ``dict`` containing the keys 'condition',
        'negate', and 'value'.
        If 'comparators' = {'condition': '>=', 'negate': False, 'value': 1},
        this example will be rendered as 'foo >= FLOAT('1')' in the query.
        ``list`` of field names to group by
    order_by : dict, optional
        Keys = {'field', 'direction'}. `dict` should be formatted as
        {'field':'TimeStamp, 'direction':'desc'} or similar
    limit : int, optional
        Limit the amount of data needed to be returned.

    Returns
    -------
    str
        A rendered query