---
# System prepended metadata

title: 'SP-1603: Remove alluxio protocol from datatable info shared with user'

---

# SP-1603: Remove alluxio protocol from datatable info shared with user

User gets datatable path used in development tool
```mermaid
sequenceDiagram
participant UJ as User/Jupyter
participant GW as Gateway
participant IL as InternalLogic

UJ ->> GW: [get] /internal/v1/development-tool/contract-info
GW ->> IL: Get contract's info
IL -->> IL: Get datatables associate with the contract
Loop datatables:
    IL ->> IL: genSDSPath(datatable.uuid)
end
IL -->> GW: datatable that has binding be set to sds path
GW -->> UJ: response
note over GW, UJ: {...,"input_datasets": [{"uuid": "xxx", "name": "xxx", "datatables": [{"uuid":"fake_uuid","binding":"/sds/datatable/fake_uuid",.....}]},...], ....}
```

User uses the sds path when reading data in spark
```mermaid
sequenceDiagram
participant UJ as User/Jupyter
participant SP as SPARK
participant GW as Gateway
participant IL as InternalLogic

UJ ->> SP: spark.read.csv('/sds/datatable/fake_uuid')
SP ->> GW: GetActualDatatablePathApi
note over SP, GW: development_tool_license, /sds/datatable/fake_uuid
GW ->> IL: getActulDatatablePath
IL ->> IL: getDatatableUUIDFromSDSPath
IL ->> IL: getDatatableFromDB
IL ->> IL: replaceDatatableBindingProtocol
IL ->> GW: actual datatable path
GW -->> SP: response
note over GW, SP: {"path": "alluxio://xxx/yyy"}
SP ->> SP: replace path with gateway response
SP ->> SP: execute remain spark logic
```

Example pseudo code to transform datatable's binding
```javascript=
const util = {
    genSDSPath: (datatableUUID) => {
        return `/sds/datatable/${datatableUUID}`       
    }, 
    getDatatableUUIDFromSDSPath: (sdsPath) => {
        if (isValidSDSPath(sdsPath)) {
            throw new Error('invalid path')
        }
        
        return sdsPath.substring('/sds/datatable/'.length)
    }
}
```
