Skip to content

LoadTableFromStorageJob: allow adding sources from blobs, bucket + glob #2126

Description

@tseaver

Default the initial source_uris to an empty list, then add methods to add extra sources. E.g.:

classLoadTableFromStorageJob(_AsyncJob):
...
def__init__(self, name, destination, source_uris=(), client, schema=()):
super(LoadTableFromStorageJob, self).__init__(name, client)
self.destination=destinationself.source_uris=list(source_uris)
# Let the @property do validation.self.schema=schemaself._configuration=_LoadConfiguration()
...
defadd_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 '*' """ifisinstance(bucket, Bucket):
bucket=bucket.nameself.source_uris.append('gs://%s/%s/'% (bucket, glob))
defadd_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.nameself.source_uris.append('gs://%s/%s/'% (bucket, blob.name))

Metadata

Metadata

Labels

api: bigqueryIssues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions