# Path: gitmostwanted/lib/bigquery/result.py
# class ResultJob(ResultWithRows):  # @todo #0:180m add field names from schema
#     pass
# 
# Path: gitmostwanted/lib/bigquery/service.py
# class ServiceGmw(Service):
#     """
#     :type __project_id: str
#     """
#     def __init__(self, json_key_path: str, project_id: str):
#         self.__project_id = project_id
#         super().__init__(
#             json_key_path, 'bigquery', 'v2', 'https://www.googleapis.com/auth/bigquery'
#         )
# 
#     @property
#     def project_id(self):
#         return self.__project_id


from gitmostwanted.lib.bigquery.result import ResultJob
from gitmostwanted.lib.bigquery.service import ServiceGmw
from itertools import chain
from uuid import uuid4
        return self.__complete

    @property
    def info(self):
        if not self.id:
            raise JobNotStartedException('The job is not started yet')
        return self.__api.jobs()\
            .get(projectId=self.__api.project_id, jobId=self.id)\
            .execute(num_retries=self.num_retries)

    @property
    def results(self):
        return chain.from_iterable(self.pages)

    @property
    def pages(self):
        if not self.complete:
            raise JobIncompleteException('The job is not complete yet')

        kwargs = {'projectId': self.__api.project_id, 'jobId': self.id}
        has_next = True
        while has_next:
            response = self.__api.jobs()\
                .getQueryResults(**kwargs)\
                .execute(num_retries=self.num_retries)

            has_next = ('pageToken' in response)
            if has_next:
                kwargs['pageToken'] = response['pageToken']


# Path: gitmostwanted/lib/bigquery/result.py
# class ResultJob(ResultWithRows):  # @todo #0:180m add field names from schema
#     pass
# 
# Path: gitmostwanted/lib/bigquery/service.py
# class ServiceGmw(Service):
#     """
#     :type __project_id: str
#     """
#     def __init__(self, json_key_path: str, project_id: str):
#         self.__project_id = project_id
#         super().__init__(
#             json_key_path, 'bigquery', 'v2', 'https://www.googleapis.com/auth/bigquery'
#         )
# 
#     @property
#     def project_id(self):
#         return self.__project_id


# Path: gitmostwanted/lib/bigquery/job.py
from gitmostwanted.lib.bigquery.result import ResultJob
from gitmostwanted.lib.bigquery.service import ServiceGmw
from itertools import chain
from uuid import uuid4

        return self.__complete

    @property
    def info(self):
        if not self.id:
            raise JobNotStartedException('The job is not started yet')
        return self.__api.jobs()\
            .get(projectId=self.__api.project_id, jobId=self.id)\
            .execute(num_retries=self.num_retries)

    @property
    def results(self):
        return chain.from_iterable(self.pages)

    @property
    def pages(self):
        if not self.complete:
            raise JobIncompleteException('The job is not complete yet')

        kwargs = {'projectId': self.__api.project_id, 'jobId': self.id}
        has_next = True
        while has_next:
            response = self.__api.jobs()\
                .getQueryResults(**kwargs)\
                .execute(num_retries=self.num_retries)

            has_next = ('pageToken' in response)
            if has_next:
                kwargs['pageToken'] = response['pageToken']


            yield ResultJob(response)