Hi everyone
I've got a question regarding moving some table data from an Oracle DB to a numpy arrays. I've looked into the possibility of using cx_Oracle to access my Oracle DB and read data (tested, works) and now I'd like to make numpy arrays out of the data to work with the table data locally. The thing is, I don't know the table/field structure of the source data before I begin, so I can't really hardcode the numpy.dptyp() field types up front. Do anyone know if there is a way of getting this from the Oracle DB using cx_Oracle so I can build the numpy.dptyp() for each table?
Alternatively, of course, is there a better way of achieving this that I haven't thought of? (Let's assume I don't have access to arcpy and Oracle connections there...)
Solved! Go to Solution.
Cursor.description will provide you the information you need, but you will have to create a mapping between cx_Oracle types and NumPy types. It might also be worth checking out oracle_util.py on GitHub.
Cursor.description will provide you the information you need, but you will have to create a mapping between cx_Oracle types and NumPy types. It might also be worth checking out oracle_util.py on GitHub.
Thank you.. The cursor.description seems to be what I'm looking for. The results from there should be parseable per table, and should be useable to create my numpy tables
I'll have a look at oracle_util.py as well. I've looked into it before and didn't quite like that it required a hack to cx_Oracle.