cx oracle python example query large table

Solutions on MaxInterview for cx oracle python example query large table by the best coders in the world

showing results for - "cx oracle python example query large table"
Louise
09 Jan 2018
1import cx_Oracle
2import time
3import pandas
4
5user = "test"
6pw = "test"
7dsn="localhost:port/TEST"
8
9con = cx_Oracle.connect(user,pw,dsn)
10start = time.time()
11cur = con.cursor()
12cur.arraysize = 10000
13try:
14    cur.execute( "select * from test_table" )
15    names = [ x[0] for x in cur.description]
16    rows = cur.fetchall()
17    df=pandas.DataFrame( rows, columns=names)
18    print(df.shape)
19    print(df.head())
20finally:
21    if cur is not None:
22        cur.close()
23
24elapsed = (time.time() - start)
25print(elapsed, "seconds")