Insert query from a select using tuples

Viewed 34

I'm making this script where I need to insert values from a MySQL database to another. Thing is I've run into this lines of code:

with cursor2(SSDictCursor) as cur:
cur.connection
for i in filas:
    query = cur.execute(f'INSERT INTO table (value1, value2) VALUES (i['valueA'],i['valueB'])')

    cur.connection2.commit()

Thing is this gives an error where I can't get the values like this, I know, but I've tried anything and I'm kinda desperate with this.

Another thing I've tried is

    with cursor2(SSDictCursor) as cur:
cur.connection
for i in filas:
    insert = i['valueA'],\
             i['valueB']

    query = cur.execute(f'INSERT INTO table (value1, value2) VALUES '
                       (f'({insert})')

    cur.connection2.commit()

And this doesn't seem to work either and I've ran out of ideas.

0 Answers
Related