python pandas dataframe 读取和写入Oracle

1、代码:主要写入时表要为小写,否则报错

   Could not reflect: requested table(s) not available in Engine

from sqlalchemy import create_engine
conn_string='oracle+cx_oracle://admin:admin@192.168.923.147:1521/ORCL?charset=utf8'
engine = create_engine(conn_string, echo=False,encoding='utf-8') # ,encoding = "UTF-8", nencoding = "UTF-8"
print(engine)
data.to_sql('erp_goods_price', con=engine,if_exists='replace',index=False,chunksize=100) #,dtype='utf-8'
# result = pd.read_sql("SELECT GOODSID,GOODSNAME FROM DIM_ERP_PUB_GOODS",con=engine)
# print(result)

 

  

 

posted @ 2019-09-28 15:46  洺剑残虹  阅读(4293)  评论(0编辑  收藏  举报