-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
Default the initial source_uris to an empty list, then add methods to add extra sources. E.g.:
class LoadTableFromStorageJob(_AsyncJob):
...
def __init__(self, name, destination, source_uris=(), client, schema=()):
super(LoadTableFromStorageJob, self).__init__(name, client)
self.destination = destination
self.source_uris = list(source_uris)
# Let the @property do validation.
self.schema = schema
self._configuration = _LoadConfiguration()
...
def add_bucket_source(self, bucket, glob):
"""Add a source URI for blobs matching 'glob' in 'bucket'.
:type bucket: string or :class:`~gcloud.storage.bucket.Bucket`
:param bucket: bucket or bucket name
:type glob: string
:param glob: blob name or name prefix with '*'
"""
if isinstance(bucket, Bucket):
bucket = bucket.name
self.source_uris.append('gs://%s/%s/' % (bucket, glob))
def add_blob_source(self, blob):
"""Add a source URI for a single blob.
:type blob: :class:`~gcloud.storage.blob.Blob`
:param blob: blob
"""
bucket = blob.bucket.name
self.source_uris.append('gs://%s/%s/' % (bucket, blob.name))Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.