pandas dataframe to oracle-NotImplementedError

我正在尝试插入 pandas dataframe 在表格中 to oracle 使用以下代码:


tabl.to_sql/'RESULT', cnxn, flavor='oracle', if_exists='replace'/;


尽管如此,我遇到了以下错误:


Traceback /most recent call last/:
File "./pp.py", line 125, in <module>
tabl.to_sql/'RESULT', cnxn, flavor='oracle', if_exists='replace'/;
File "/opt/local/anaconda/lib/python2.7/site-packages/pandas/core/generic.py", line 950, in to_sql
index_label=index_label/
File "/opt/local/anaconda/lib/python2.7/site-packages/pandas/io/sql.py", line 467, in to_sql
pandas_sql = pandasSQL_builder/con, flavor=flavor/
File "/opt/local/anaconda/lib/python2.7/site-packages/pandas/io/sql.py", line 521, in pandasSQL_builder
return PandasSQLLegacy/con, flavor, is_cursor=is_cursor/
File "/opt/local/anaconda/lib/python2.7/site-packages/pandas/io/sql.py", line 1017, in __init__
raise NotImplementedError
NotImplementedError


我已经安装了 cx_oracle. 版本 Pandas - 这是 0.14.1 / 经过 Anaconda-2.1/. 任何灯都会非常感激。
</module>
已邀请:

八刀丁二

赞同来自:

Oracle 通过 SQLAlchemy /实际上,可以使用的数据库的所有变体 SQLAlchemy/. 所以你需要做
http://docs.sqlalchemy.org/en/ ... racle
SQLAlchemy :


from sqlalchemy import create_engine
engine = create_engine/'oracle+cx_oracle://scott:tiger@tnsname'/

tabl.to_sql/'RESULT', engine, if_exists='replace'/


请参阅此处的解释:
http://pandas.pydata.org/panda ... eries
. 为此,你至少需要 pandas >= 0.14.

早些时候有一个关键字
flavor

真的只支持 sqlite 和 mysql, 如..所示 @cel. 这
flavor

现在过时,只有
sqlite

将在不使用的情况下得到支持 sqlalchemy.

君笑尘

赞同来自:

在文件中
http://pandas.pydata.org/panda ... .html
你会发现目前的论点
flavor

也许只是
sqlite

或者
mysql

.


flavor : {‘sqlite’, ‘mysql’}, default ‘sqlite’
The flavor of SQL to use. Ignored when using SQLAlchemy engine.
‘mysql’ is deprecated and will be removed in future versions, but it will be
further supported through SQLAlchemy engines.


提高
NotImplementedError

这是尚不清楚的。 在
github

已经有了曼联
https://github.com/pydata/pand ... 37da0
, 这改善了错误消息。

要回复问题请先登录注册