# Data Pool

In the following section we describe how to store data on the Sandbox. There are four different ways to do achieve: Inside the Sandbox, headless file upload & user interface on Object storage and Git LFS. 

![Sandbox Data Pool](res/sandbox_datapool.png)


## Inside the Sandbox
To store the data inside the Sandbox, you just have to drag & drop or click on the upload button to save the file to your running instance. You can also create folders and new Notebooks. Please see the free space limitations [here](sandbox/dev_env#resources.md).
![file upload](res/sandbox_upload_file_selector.png "File Upload")


## Share CLI (Headless)
To use the headless object storage, you can upload a file via REST-Interface or curl. The json response message provides you the destination url.

**Upload Example**
```python 
    import requests

    url = "https://share.storage.sandbox.iuk.hdm-stuttgart.de/upload"
    filename = "ds_salaries.csv"
    files = {'fileUpload': (filename, open(filename, 'rb'),'text/csv')}
    r = requests.post(url, files=files)   
```
**Example JSON response**
```json
{
	"PublicUrl": "https://storage.sandbox.iuk.hdm-stuttgart.de/upload/a1236b2b-49bf-4047-a536-20dab15b7777/untitled.txt",
	"Size": 11,
	"Expiration": "2023-10-04T00:00:00Z"
}
```

**Import Example**
```python 
    import pandas as pd
    
    url = "https://storage.sandbox.iuk.hdm-stuttgart.de/upload/ec6c1c9c-ea9b-47ff-97cf-f92d870e8fb9/ds_salaries.csv"
    df = pd.read_csv(url)
```


## Share UI
[Share UI](https://share.sandbox.iuk.hdm-stuttgart.de/) is a web application that allows file transfer between all user groups. The user interface allows you to drag and drop files onto the sandbox, delete them and set passwords, which provides additional security for the data. Once the file has been successfully uploaded, a URL can be used to make the file(s) available to course participants or other user groups. 


## Git LFS
The following solution we highly recomment only for users which are familiar with git command line tools! Git Large File Storage (LFS). An open source Git extension for versioning large files. Git LFS replaces large files (audio, sample, datasets, videos) by a text pointer inside git. The files get stored on our gitea Server.
For further information visit [Git LFS](https://git-lfs.com/).


## Troubleshooting
- Files do not exist anymore after a certain period of time: The shared space is limited to 3 or 6 months.
- Impossible to curl from Share UI: The Share UI is mainly for UI users only, please use the Share CLI instead


## Useful Links 

- [CLI Share](https://share.storage.sandbox.iuk.hdm-stuttgart.de/upload/uuid/filename)           
- [Share UI](https://share.sandbox.iuk.hdm-stuttgart.de/)    
- [Curl](https://curl.se/docs/tutorial.html)                                        
- [GIT LFS](https://git-lfs.com/)                                       
