1.import cx-Oracle,sqlalchemy,matplotlib
2.下载 oracle_instance_win_XXX.zip
3.将压缩包里的dll文件解压到python安装路径下site-package文件夹下
4.
# 导入包
import os
from sqlalchemy import create_engine
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
# 同样的套路,创建连接引擎
engine = create_engine('oracle+cx_oracle://username:[email protected]:port/DBSERVICENAME')#servicename在oracle安装目录子文件夹下的tnsnames.ora文件中找到,搜索一下
#excute sql
data = pd.read_sql('select * from tablename where rownum <1000000 ', engine)
print(data.describe())