====Insert====
*https://dev.mysql.com/doc/connector-python/en/connector-python-example-cursor-transaction.html
<pre>
import mysql.connector
def ins():
add_song_element = ("INSERT INTO song_element "
"(element, reading, reading_rev) "
"VALUES (%s, %s, %s)")
config = {
'user':'song_dict',
'password':'my password',
'host':'192.168.0.43',
'database':'song_dict'
}
try:
cnx = mysql.connector.connect(**config)
cursor = cnx.cursor()
cursor.execute(add_song_element, ('hoge', 'foo', 'bar'))
except Exception as ee:
print(ee)
</pre>
==[[Tips]]==