Python code not deleting record from database
Question: This is the code I have to delete a record from two tables in my database that
share the same ID code and I'm not too sure where I've gone wrong. Anything
missing? I've checked this a million times

    
    
    def deletePhoto(photoID):
    
        """
        Middleware function to delete a photo post
        """
    
        #connect to the database
        conn, cursor = getConnectionAndCursor()
    
        #create sql to delete from the ratings table
        sql = """
        DELETE
        FROM ratings
        WHERE photoID= %s
        """
    
        #set the parameters
        parameters = (photoID)
    
        #execute the sql
        cursor.execute(sql, parameters)
    
        #create sql to delete from the photo table
        sql = """
        DELETE
        FROM photo
        WHERE photoID = %s
        """
    
        #set the parameters
        parameters = (photoID)
    
        #execute the sql
        cursor.execute(sql, parameters)
    
        #fetch the data
        data = cursor.rowcount
    
        #clean up
        conn.commit()
        cursor.close()
        conn.close()
    


Answer: You might try adding a sleeper after your executes. It can take some time for
the server to process your query.

    
    
    import time
    time.sleep(x) 
    

x in seconds

