All Products
Document Center

DSW Read Data From MaxCompute

Last Updated: Mar 02, 2020

PAI-DSW can read data from PAI-Studio or MaxCompute by installing PYODPS package,PYODPS is a python SDK develped by AlibabaCloud.


How to Start

1.Install PYODPS

Enter DSW-> DSW Terminal-> Type in:

  1. pip install --user pyodps

2.Operations on Maxcompute Table

Demo Code(Show the head 10 lines of certain table)

  1. from odps import ODPS
  2. from odps.df import DataFrame
  3. o = ODPS('*accessKey ID*', '*accesskey Secret*',project='*Maxcompute Project Name*', endpoint='')
  4. users = DataFrame(o.get_table('*Project Name*'))
  5. print(users.head(10))