pandas dataframe to oracle - NotImplementedError
Question: I am trying to insert a pandas dataframe in to oracle table with the following
code:

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

however, I am running in to the following error:

    
    
    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
    

I've cx_oracle installed. Pandas version is 0.14.1 ( from Anaconda-2.1). Any
lights would be much appreciated.


Answer: Oracle is supported through SQLAlchemy (in fact, all database flavors that can
be used with SQLAlchemy are supported). Therefore you need to make a
[SQLAlchemy
engine](http://docs.sqlalchemy.org/en/latest/dialects/oracle.html#module-
sqlalchemy.dialects.oracle.cx_oracle):

    
    
    from sqlalchemy import create_engine
    engine = create_engine('oracle+cx_oracle://scott:tiger@tnsname')
    
    tabl.to_sql('RESULT', engine, if_exists='replace')
    

See the explanation here: <http://pandas.pydata.org/pandas-
docs/stable/io.html#sql-queries>. You need at least pandas >= 0.14 for this.  
Previously, through the `flavor` keyword, indeed only sqlite and mysql were
supported, as @cel points out. This `flavor` is now deprecated, and only
`sqlite` will remain supported without using sqlalchemy.

