

def import_data_from_uris(self, source_uris, dataset, table, schema=None, job=None, source_format=None, create_disposition=None, write_disposition=None, encoding=None, ignore_unknown_values=None, max_bad_records=None, allow_jagged_rows=None, allow_quoted_newlines=None, field_delimiter=None, quote=None, skip_leading_rows=None):
    '\n        Imports data into a BigQuery table from cloud storage. Optional\n        arguments that are not specified are determined by BigQuery as\n        described:\n            https://developers.google.com/bigquery/docs/reference/v2/jobs\n\n        Parameters\n        ----------\n        source_urls : list\n            A ``list`` of ``str`` objects representing the urls on cloud\n            storage of the form: gs://bucket/filename\n        dataset : str\n            String id of the dataset\n        table : str\n            String id of the table\n        job : str, optional\n            Identifies the job (a unique job id is automatically generated if\n            not provided)\n        schema : list, optional\n            Represents the BigQuery schema\n        source_format : str, optional\n            One of the JOB_SOURCE_FORMAT_* 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        encoding : str, optional\n            One of the JOB_ENCODING_* constants\n        ignore_unknown_values : bool, optional\n            Whether or not to ignore unknown values\n        max_bad_records : int, optional\n            Maximum number of bad records\n        allow_jagged_rows : bool, optional\n            For csv only\n        allow_quoted_newlines : bool, optional\n            For csv only\n        field_delimiter : str, optional\n            For csv only\n        quote : str, optional\n            Quote character for csv only\n        skip_leading_rows : int, optional\n            For csv only\n\n        Returns\n        -------\n        dict\n            A BigQuery job response\n\n        Raises\n        ------\n        JobInsertException\n            on http/auth failures or error in result\n        '
    source_uris = (source_uris if isinstance(source_uris, list) else [source_uris])
    configuration = {
        'destinationTable': {
            'projectId': self.project_id,
            'tableId': table,
            'datasetId': max_bad_records,
        },
        'sourceUris': source_uris,
    }
    if max_bad_records:
        configuration['maxBadRecords'] = max_bad_records
    if ignore_unknown_values:
        configuration['ignoreUnknownValues'] = ignore_unknown_values
    if create_disposition:
        configuration['createDisposition'] = create_disposition
    if write_disposition:
        configuration['writeDisposition'] = write_disposition
    if encoding:
        configuration['encoding'] = encoding
    if schema:
        configuration['schema'] = {
            'fields': schema,
        }
    if source_format:
        configuration['sourceFormat'] = source_format
    if (not job):
        hex = self._generate_hex_for_uris(source_uris)
        job = '{dataset}-{table}-{digest}'.format(dataset=dataset, table=table, digest=hex)
    if (source_format == JOB_SOURCE_FORMAT_CSV):
        if field_delimiter:
            configuration['fieldDelimiter'] = field_delimiter
        if allow_jagged_rows:
            configuration['allowJaggedRows'] = allow_jagged_rows
        if allow_quoted_newlines:
            configuration['allowQuotedNewlines'] = allow_quoted_newlines
        if quote:
            configuration['quote'] = quote
        if skip_leading_rows:
            configuration['skipLeadingRows'] = skip_leading_rows
    elif (field_delimiter or allow_jagged_rows or allow_quoted_newlines or quote or skip_leading_rows):
        all_values = dict(field_delimiter=field_delimiter, allow_jagged_rows=allow_jagged_rows, allow_quoted_newlines=allow_quoted_newlines, skip_leading_rows=skip_leading_rows, quote=quote)
        non_null_values = dict(((k, v) for (k, v) in list(all_values.items()) if v))
        raise Exception(('Parameters field_delimiter, allow_jagged_rows, allow_quoted_newlines, quote and skip_leading_rows are only allowed when source_format=JOB_SOURCE_FORMAT_CSV: %s' % non_null_values))
    body = {
        'configuration': {
            'load': configuration,
        },
        'jobReference': {
            'projectId': self.project_id,
            'jobId': job,
        },
    }
    logger.debug(('Creating load 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.import_data_from_uris/VarMisuse@109/769 `dataset`->`max_bad_records`