If the two databases are a physical machine ~ INSERTINTODB. TBSELECT * FROMDA. TAWHERE... but if the two databases belong to two physical machines ~~ I use sqlalchemy ~ Section 1 fetsesssiona.exe cute (& amp; #39; SELECT * FROMTAWHERE... & amp; #39 ;). fetchall () Section 2 & #39; & #39; & #39; dict constructed based on fet & #39; & #39; & #39; Section 3 sessionB. add_all (* mysqlsqlalchemypython
If the two databases are a physical machine ~
Insert into db. tb select * from da. ta where ....
However, if two databases belong to two physical machines ~~ I use sqlalchemy ~
Section 1
Fet = sesssionA.exe cute ('select * from ta where... '). fetchall ()
Section 2
''' Is constructed into dict ''' based on the fet '''
Section 3
SessionB. add_all (** dict)
SessionB. commit ()
The overall time consumption is very large, and the three paragraphs are almost the same. I have a limited understanding of sqlalchmey. Is there any good way to transfer between the two sessions of sqlalchemy ~~