Skip to content

Storage: fetch specific object version #5546

@thakursc1-zz

Description

@thakursc1-zz

Is there a way to query a specific version of an object from cloud storage?

def get_file_from_bucket(kind, id, ver:str)->dict:
    bucket = "bucket123"
    blob_path = "records" + "/" + kind + "/" + id+"#"+ver
    print("{}".format(blob_path))
    cred_file = Path(os.path.dirname((os.path.dirname(os.path.abspath(__file__)))),"service_file")
    storage_client = storage.Client.from_service_account_json(cred_file)
    bucket = storage_client.get_bucket(bucket)
    b = bucket.get_blob(blob_path)
    return b

>> None

The above function returns None, but when I remove the version I get the respective object. Is there a way to retrieve an object with specified version?

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.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