I have the table structure in one db is number,photo,date,name.
the same structure is there in other database in other machine.

I want to insert table1 data from db1 into table2 in db2 using python script.

Some one could please help me in this.. I have tried like below.

for fetching rows
db connection 
cur=db.cursor()
SqlFth="select no,photo,date,name from table1;
cur.execute(SqlFth)
res=cur.fetchall()
rows=[]
for row in res:
    no,photo,date,name=row
    rows.append(row)
    n1= row[0]
    f1=row[1]
    d1=row[1]
    na1=row[2]

for inserting to other db:

    SqlStr="insert into test (no,photo,date,name) values(:n1,:f1,:d1,:na1)"
    print SqlStr
    cur.executemany(SqlStr,rows)
    res1=cur.fetchone()
    cur.execute("commit")

Please help me in this...
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to