Skip to content

GONRG-3431 manage bundles

Aleksandr Spivakov (EPAM) requested to merge GONRG-3431_manage_bundles into master

First approach using Python SDK

The logic for managing bundles implemented within OSDU Python SDK. Example of using:

# importing function responsible for instantiating specific CSP storage client
from osdu_api.providers.blob_storage import get_client

# instantiate storage client
client = get_client()

# uploading file
f = open(<file_name>, 'rb')
client.upload_file(<file_uri>, f, <content_type>)
f.close()

# retrieving file (into file directly)
f = open(<file_name>, 'wb')
client.download_to_file(<file_uri>, f)
f.close()

# retrieving file (as bytes)
content, content_type = client.download_file_as_bytes(<file_uri>)

Second approach using Facade, implemented in this MR

note: GCP implementation still use Python SDK under the hood. Example of using:

# importing function responsible for instantiating specific CSP storage client
from bundles.storage import get_storage

# instantiate storage client
storage = get_storage()

# uploading file
f = open(<file_uri>, 'rb')
storage.upload_file(<file_uri>, f)
f.close()

# retrieving file (into file directly)
f = open(<file_uri>, 'wb')
storage.download_file(<file_uri>, f)
f.close()

Related to #50 (closed)

Edited by Siarhei Khaletski (EPAM)

Merge request reports