python - PySide/PyQt: insert data/table from database to another database -
this question has answer here:
- copy table remote sqlite database? 1 answer
working pyside. have sqlite database default database:
db1 = qtsql.qsqldatabase.adddatabase("qsqlite") db1.setdatabasename(path_of_db) db1.open()
and second database connection name "second_db":
db2 = qtsql.qsqldatabase.adddatabase("qsqlite", "second_db") db2.setdatabasename(path_of_db) db2.open() query = qsql.qsqlquery("second_db") query.exec_("select * table_name")
now want insert records table db1
table db2
. have model db1. know can insert record per record through models. thought writing records db1
in file/variable , insert these db2
. there simpler/quicker solution maybe sql-query? how can solve problem?
thank ;-)
i'd try row row insertion, , see how fast is. might need. few tips on bulk insertions here; basically,if use begin , end transaction, , in-memory journal speed inserts. oh , create indexes after you're done, not before.
Comments
Post a Comment