Post date: Feb 19, 2015 6:23:33 AM
Here is an example or the code:
import pandas as pdimport cx_Oracle## db parametersuser_name = 'myusernamehere'password = 'mypasswordhere'query = 'select * from mydbdb.table_name where rownum < 20 and creation_date > sysdate - 2'## connect to the DW and query the datadsn = cx_Oracle.makedsn('Thehostname', portnumber, 'Thedbname')con = cx_Oracle.connect(user_name, password, dsn)curs = con.cursor()curs.execute(query)## Convert the cx_Oracle object to pandas dataframeheaders = [ x[0] for x in curs.description]data = curs.fetchall()df = pd.DataFrame( data, columns=headers)## display the dataframedf## The type conversion is also pretty accuratedf.dtypesSomeone package the whole thing into a function [here].
Another good tutorial by utexas here.