Skip to content

Autodetect feature is not available in BigQuery client #2926

Description

@teiuaz

Autodetect feature works only if the body of the request contains a schema field.
For example, that works fine:

job= {
'projectId': PROJECT_ID,
'configuration': {
'load': {
'autodetect': True, # works without it, by default autodetect = True 'destinationTable': {
'projectId': PROJECT_ID,
'datasetId': self.dataset,
'tableId': self.table,
},
'sourceUris': [self.path],
'writeDisposition': self.write_disposition
}
}
}

The task will be failed if schema path is not specified in the task params.

May be this code in the client works unexpected(job.py):

resource= {
'jobReference': {
'projectId': self.project,
'jobId': self.name,
},
'configuration': {
self._JOB_TYPE: {
'sourceUris': self.source_uris,
'destinationTable': {
'projectId': self.destination.project,
'datasetId': self.destination.dataset_name,
'tableId': self.destination.name,
},
},
},
}
configuration=resource['configuration'][self._JOB_TYPE]
self._populate_config_resource(configuration)
iflen(self.schema) >0:
configuration['schema'] = {
'fields': _build_schema_resource(self.schema)}

Metadata

Metadata

Labels

api: bigqueryIssues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions