Answers for "get sql query result and insert into python list of dicts"

CSS
0

Using a Python dict for a SQL INSERT statement

sql = "INSERT INTO %s (%s) VALUES(%s)" % (
    table, ",".join(cols), ",".join(vals))
Posted by: Guest on May-15-2021
0

sql insert query list of dictionaries

cursor.executemany("""
    INSERT INTO 
        mytable
        (id, price, type)
    VALUES
        (%(id)s, %(price)s, %(type)s)
""", lst)
Posted by: Guest on December-11-2020

Code answers related to "get sql query result and insert into python list of dicts"

Browse Popular Code Answers by Language