cursor.execute(
    """
            INSERT INTO Songs (SongName, SongArtist, SongAlbum, SongGenre, SongLength, SongLocation)
            VALUES
                (%(name)s, %(artist)s, %(album)s, %(genre)s, %(length)s, %(location)s)
        """
    , some_dictionary_with_the_data)
Параметризованные запросы Python MySQL