@staticmethod
def _build_query(tokens):
    """Build query tuple

        :param tokens:
        :rtype : tuple
        :return: tuple query data

        Return value example:
            "INSERT INTO test (num, data) VALUES (%s, %s)", (42, 'bar')

        """
    sql_str_parts, values = [], ()
    for key, token in tokens.items():
        if not token.is_set:
            continue
        eval_result = token.eval()
        if isinstance(eval_result, str):
            sql_str_parts.append(eval_result)
        elif isinstance(eval_result, tuple):
            sql_str_parts.append(eval_result[0])
            values += tuple(eval_result[1])
    query = ' '.join(sql_str_parts), values
    return query
