Use connection.commit() method to save data in Oracle Database using Python. The below is an example:
Save Data in Oracle Database Using Python Example
In the following Python program, it will create the connection using the cx_Oracle library in variable CONN and then will execute an update statement to update EMP table's comm column. After that, before closing the Oracle database connection, it will save the changes using the COMMIT() method.
import cx_Oracle conn = cx_Oracle.connect("scott", "tiger", "localhost:1521/orcl") cur = conn.cursor() cur.execute('update emp set comm = sal * 10 / 100') conn.commit() cur.close() conn.close()
Hi,
I need python script to pull the data from Oracle database and insert into Postgresql database.
could you please help me.
Regards,
Imran
Below is an example of pulling data from Oracle in Python:
The above Python code is pulling data from Oracle and printing on the screen in the For loop.
You can insert the data into PostgresSQL in the For Loop section instead of printing it.
Check the following tutorial for the Inserting records into PostgresSQL from Python.