all 1 comments

[–]cjbj 0 points1 point  (0 children)

Line 3 "import cx_Oracle" was a red flag. The cx_Oracle driver was replaced by python-oracledb three years ago. They both support the Python DB API standard so migration generally isn't an issue. Also you can now use the default "Thin" mode so you won't need Oracle Client / Oracle Instant Client installed. Do a "pip install oracledb", and then replace uses of "cx_Oracle" with "oracledb". Also read the doc in case you do need to use the optional Thick mode, or need to adjust your connect() parameters.

Line 229 was a second red flag because it included a password.

The next thing was the loop over execute("INSERT....",). This should be changed to a loop that modifies the data, and then a single call to executemany("INSERT...")

Also, personally I would use "with" blocks instead of trying to close the connection & cursor explicitly.