import psycopg2 # Establish a connection to the PostgreSQL database conn = psycopg2.connect("your_connection_string") # Set autocommit mode to True conn.autocommit = True # Create a cursor cur = conn.cursor() # Execute SQL statements cur.execute("INSERT INTO your_table (column1, column2) VALUES (%s, %s)", (value1, value2)) # No need to call conn.commit() explicitly in autocommit mode # Close cursor and connection when done cur.close() conn.close()