Radler Yeo
Radler Yeo

Reputation: 31

How to load S3 data source with atoti?

Following the installation guide, I have installed atoti library:

(atoti) C:\Users>conda list
# packages in environment at C:\Apps\miniconda3\envs\atoti:
#
# Name                    Version                   Build  Channel
abseil-cpp                20200225.2           ha925a31_2    conda-forge
aplus                     0.11.0                   pypi_0    pypi
appdirs                   1.4.3                      py_1    conda-forge
argon2-cffi               20.1.0           py38h1e8a9f7_1    conda-forge
arrow-cpp                 1.0.1           py38h1234567_1_cpu    conda-forge
astropy                   4.0.1.post1              pypi_0    pypi
atoti                     0.4.3                   9238575    https://conda.atoti.io
attrs                     20.1.0             pyh9f0ad1d_0    conda-forge
...

I have also downloaded the Pnl Explained notebook from atoti's github and I am trying to read a file on s3:

position_sensitivity_store = session.read_csv(
    "https://data.atoti.io/notebooks/pnl-explained/position_sensitivities.csv",
    keys=["book_id", "instrument_code", "currency", "curve", "tenor"],
    store_name="Position Sensitivities Store",
)

I encountered the below exception:

OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'https:\\data.atoti.io\\notebooks\\pnl-explained\\position_sensitivities.csv'

I am able to access the file directly from the browser. How can I load the source files into atoti? Do I need additional libraries to read the source files on S3?

Upvotes: 1

Views: 277

Answers (1)

Kineolyan
Kineolyan

Reputation: 743

To load S3 data, you need to use the scheme s3, as shown in the new version of the notebook:

position_sensitivity_store = session.read_csv(
    "s3://data.atoti.io/notebooks/pnl-explained/position_sensitivities.csv",
    keys=["book_id", "instrument_code", "currency", "curve", "tenor"],
    store_name="Position Sensitivities Store",
)

See this page [1] for complete reference.

Because you point to data provided by the notebook, as the notebook was moved - according to the new document at the end of your link - I suspect that the data it uses was also moved somewhere else. BTW, it is now here [2].

[1] https://docs.atoti.io/0.4.3/data-access.html# [2] https://github.com/atoti/notebooks/blob/master/notebooks/pnl-explained/main.ipynb

Upvotes: 2

Related Questions