Python psycopg2 DELETE data in AWS, no result, no error [duplicate]












-2
















This question already has an answer here:




  • Psycopg2 insert not saved

    1 answer




I try to delete data in a table in AWS. The code below works well if I pull data from AWS.



import psycopg2
import pandas as pd

con=psycopg2.connect(dbname= My_Credential.....)
cur = con.cursor()

sql = """
DELETE FROM my_table
"""

cur.execute(sql)


After runing the code, I don't have any error message, but if I go check the data in that table, the data is still there. I wonder if I need to add any code like to COMMIT the change?



please advise. thanks










share|improve this question













marked as duplicate by cmaher, Community Nov 20 '18 at 21:00


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.























    -2
















    This question already has an answer here:




    • Psycopg2 insert not saved

      1 answer




    I try to delete data in a table in AWS. The code below works well if I pull data from AWS.



    import psycopg2
    import pandas as pd

    con=psycopg2.connect(dbname= My_Credential.....)
    cur = con.cursor()

    sql = """
    DELETE FROM my_table
    """

    cur.execute(sql)


    After runing the code, I don't have any error message, but if I go check the data in that table, the data is still there. I wonder if I need to add any code like to COMMIT the change?



    please advise. thanks










    share|improve this question













    marked as duplicate by cmaher, Community Nov 20 '18 at 21:00


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      -2












      -2








      -2









      This question already has an answer here:




      • Psycopg2 insert not saved

        1 answer




      I try to delete data in a table in AWS. The code below works well if I pull data from AWS.



      import psycopg2
      import pandas as pd

      con=psycopg2.connect(dbname= My_Credential.....)
      cur = con.cursor()

      sql = """
      DELETE FROM my_table
      """

      cur.execute(sql)


      After runing the code, I don't have any error message, but if I go check the data in that table, the data is still there. I wonder if I need to add any code like to COMMIT the change?



      please advise. thanks










      share|improve this question















      This question already has an answer here:




      • Psycopg2 insert not saved

        1 answer




      I try to delete data in a table in AWS. The code below works well if I pull data from AWS.



      import psycopg2
      import pandas as pd

      con=psycopg2.connect(dbname= My_Credential.....)
      cur = con.cursor()

      sql = """
      DELETE FROM my_table
      """

      cur.execute(sql)


      After runing the code, I don't have any error message, but if I go check the data in that table, the data is still there. I wonder if I need to add any code like to COMMIT the change?



      please advise. thanks





      This question already has an answer here:




      • Psycopg2 insert not saved

        1 answer








      python-3.x postgresql amazon-web-services






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 '18 at 17:31









      PyBossPyBoss

      477




      477




      marked as duplicate by cmaher, Community Nov 20 '18 at 21:00


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by cmaher, Community Nov 20 '18 at 21:00


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          0














          I just figured out. I need to add



          con.commit()


          to make it work






          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I just figured out. I need to add



            con.commit()


            to make it work






            share|improve this answer




























              0














              I just figured out. I need to add



              con.commit()


              to make it work






              share|improve this answer


























                0












                0








                0







                I just figured out. I need to add



                con.commit()


                to make it work






                share|improve this answer













                I just figured out. I need to add



                con.commit()


                to make it work







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 20 '18 at 17:34









                PyBossPyBoss

                477




                477















                    Popular posts from this blog

                    MongoDB - Not Authorized To Execute Command

                    How to fix TextFormField cause rebuild widget in Flutter

                    in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith