cottoncandy
cottoncandy copied to clipboard
syntax for quick access to other buckets
Sometimes we need to access data from other buckets and save our results to other buckets.
As it stands, the cc.interface
instance has a set_bucket
method for this, but it's very cumbersome:
>>> import cottoncandy as cc
>>> cci = cc.get_interface('my_data_bucket')
>>> arr = cci.download_raw_array('path/to/my/array')
>>> result = np.log(arr + 1)
>>> cci.set_bucket('my_results_bucket')
>>> cci.upload_raw_array('path/to/my/results/array', result)
>>> cci.set_bucket('my_data_bucket')
Instead, a little ~
syntax might be useful
>>> import cottoncandy as cc
>>> cci = cc.get_interface('my_data_bucket')
>>> arr = cci.download_raw_array('path/to/my/array')
>>> result = np.log(arr + 1)
>>> cci.upload_raw_array('~my_results_bucket/path/to/my/results/array', result)
>>> print cci.bucket_name # default bucket is still the same
my_data_bucket
sound good?
Yes, that looks totally reasonable.