

def write_to_table(self, query, dataset=None, table=None, external_udf_uris=[], allow_large_results=None, use_query_cache=None, priority=None, create_disposition=None, write_disposition=None):
    '\n        Write query result to table. If dataset or table is not provided,\n        Bigquery will write the result to temporary table. Optional arguments\n        that are not specified are determined by BigQuery as described:\n        https://developers.google.com/bigquery/docs/reference/v2/jobs\n\n        Parameters\n        ----------\n        query : str\n            BigQuery query string\n        dataset : str, optional\n            String id of the dataset\n        table : str, optional\n            String id of the table\n        external_udf_uris : list, optional\n            Contains extternal UDF URIs. If given, URIs must be Google Cloud\n            Storage and have .js extensions.\n        allow_large_results : bool, optional\n            Whether or not to allow large results\n        use_query_cache : bool, optional\n            Whether or not to use query cache\n        priority : str, optional\n            One of the JOB_PRIORITY_* constants\n        create_disposition : str, optional\n            One of the JOB_CREATE_* constants\n        write_disposition : str, optional\n            One of the JOB_WRITE_* constants\n\n        Returns\n        -------\n        dict\n            A BigQuery job resource\n\n        Raises\n        ------\n        JobInsertException\n            On http/auth failures or error in result\n        '
    configuration = {
        'query': query,
    }
    if (dataset and table):
        configuration['destinationTable'] = {
            'projectId': self.project_id,
            'tableId': table,
            'datasetId': dataset,
        }
    if (allow_large_results is not None):
        configuration['allowLargeResults'] = allow_large_results
    if (use_query_cache is not None):
        configuration['useQueryCache'] = use_query_cache
    if priority:
        configuration['priority'] = priority
    if create_disposition:
        configuration['createDisposition'] = create_disposition
    if write_disposition:
        configuration['writeDisposition'] = write_disposition
    configuration['userDefinedFunctionResources'] = []
    for external_udf_uri in external_udf_uris:
        configuration['userDefinedFunctionResources'].append({
            'resourceUri': external_udf_uri,
        })
    body = {
        'configuration': {
            'query': configuration,
        },
    }
    logger.info(('Creating write to table job %s' % body))
    job_resource = self._insert_job(body)
    self._raise_insert_exception_if_error(job_resource)
    return job_resource

dataset/ETHPy150Open tylertreat/BigQuery-Python/bigquery/client.py BigQueryClient.write_to_table/original