Ultima attività 1729506879

memos_migr.py Raw
1import sqlite3
2
3conn_source = sqlite3.connect('db/source.db')
4conn_target = sqlite3.connect('db/memos_prod.db')
5
6cur_source = conn_source.cursor()
7cur_target = conn_target.cursor()
8
9#? change here
10cur_source.execute('SELECT * FROM tag')
11rows = cur_source.fetchall()
12
13#? change here
14for row in rows:
15 cur_target.execute('INSERT INTO tag VALUES (?, ?)', row) # 假设表有两列
16
17conn_target.commit()
18
19conn_source.close()
20conn_target.close()