All Products
Search
Document Center

DSW Read Data From MaxCompute

Last Updated: Jul 21, 2019

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

PYODPS doc:https://pyodps.readthedocs.io/zh_CN/latest/

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='http://service-all.ext.odps.aliyun-inc.com/api')
  4. users = DataFrame(o.get_table('*Project Name*'))
  5. print(users.head(10))