How to read the data from the oracle database and then write to Excel
0
4628
First you need to Install database driver for connecting to the db as follows:
$ pip install cx_Oracle pandas
The code will be as follows:
import cx_Oracle
con = cx_Oracle.connect('username/password@dsn')
data = pd.read_sql('SELECT * FROM tablename', con)
con.close()
data.head() # Take a peek at data
data.to_excel('my_oracle_table.xlsx')
Comment here