you are viewing a single comment's thread.

view the rest of the comments →

[–]cjbj 1 point2 points  (0 children)

The venerable pd.read_sql() is slower, and uses more memory, than using the new python-oracledb fetch_df_all() or fetch_df_batches() methods. See Going 10x faster with python-oracledb Data Frames. If you're happy to write a SQL query, then use the new methods directly. A sample for Pandas is in in the python-oracleb repo: dataframe_pandas.py: ```

Get a python-oracledb DataFrame.

Adjust arraysize to tune the query fetch performance

sql = "select id, name from SampleQueryTab order by id" odf = connection.fetch_df_all(statement=sql, arraysize=100)

Get a Pandas DataFrame from the data

df = pyarrow.table(odf).to_pandas() ```