0

In python postgres sql , create and insert query is executing without error but while checking in the database it is not getting updated

Python code

cursor = self.connection.cursor()

try:

        cursor.execute("INSERT INTO success(username,email)VALUES('test5','test@mail')")

        print ("A row Inserted successfully")

except Exception as e:

       print ("Unable to insert your data - ",e)

Output

A row Inserted successfully

But the data not truly inserted into database. The select query is working fine and displaying the data which is already available in the database not newly inserted.

select Query below

cursor.execute("select * from success")

record = cursor.fetchall()

print ("record",record)

output

record []

Note: All the database connections are working fine I have checked it already. Thanks in advance

JGH
  • 15,928
  • 4
  • 31
  • 48
naveenkumar.s
  • 901
  • 8
  • 17

0 Answers0