Jan-08-2021, 12:34 AM
(This post was last modified: Jan-09-2021, 12:32 AM by jash.
Edit Reason: Fixed Wrong copy/paste of program and error message
)
Hello Everyone,
I am trying to retrieve the data from oracle and write it into excel file using python dataframe. However my challenge is that I can't modify anything on db side and the query has total 5 columns out of which 2 columns are clob hence I am unable to write it in python data frame.
Any suggestions on how to approach retrieving query result containing multiple clob columns to dataframe?
Thank you in advance.
Here's my python code. It generates excel file only with column header. Column data is missing.
I am trying to retrieve the data from oracle and write it into excel file using python dataframe. However my challenge is that I can't modify anything on db side and the query has total 5 columns out of which 2 columns are clob hence I am unable to write it in python data frame.
Any suggestions on how to approach retrieving query result containing multiple clob columns to dataframe?
Thank you in advance.
Here's my python code. It generates excel file only with column header. Column data is missing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import pandas as pd import cx_Oracle dsn = cx_Oracle.makedsn(host = '10.150.0.1' ,port = 1515 ,service_name = 'ESO_SYS21_TESTAPP.ABC.COM' ) try : con = cx_Oracle.connect(user = username, password = password, dsn = dsn ,encoding = "UTF-8" ) #, nencoding = "UTF-8") except cx_Oracle.DatabaseError as exception: print ( "failed to connect to %s\n" ,dsn) print (exception) my_sql_query = ( "select * from order where Order_id = 1234" ) df = pd.read_sql(my_sql_query, con = con) df.to_excel( 'test' + '.xlsx' , encoding = 'utf8' , index = False ) |