Python连接ODPS数据库

Python连接ODPS数据库以及数据读取

  • 主要内容

主要内容

很多情况下,数据分析师需要使用python连接数据库进行数据分析,本文内容为Python连接阿里云Dataworks下的MaxCompute(ODPS)方法。

from odps import ODPS 
o = ODPS('t1', 't2', project='t3',endpoint='t4')

sql1='''
SELECT * FROM table1;
'''
with o.execute_sql(sql1).open_reader() as reader:
    df1 = reader.to_pandas()
df1
参数 注解
t1 阿里云的Access Key ID
t2 阿里云的Access Key Secret
t3 库名
t4 接入地址

你可能感兴趣的:(python,python)