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)

 

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM