-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.
Description
I'm confused about this comment https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/storage/google/cloud/storage/blob.py#L589
What is the correct way of uploading blobs in a batch?
client = storage.Client.from_service_account_json('client-secret.json', project=PROJECT_NAME)
bucket = client.get_bucket(BUCKET_NAME)
with client.batch():
for i in range(10):
with open('base.py', 'rb') as my_file:
blob = storage.Blob('/test/{}'.format(i), bucket)
blob.upload_from_file(my_file, client=client)
This, of course, won't work because is using client._base_connection instead of client.current_batch.
gaborfeher
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.