Sqlalchemy-mysql selects table TA content from a database DA and inserts it into the TB of another database

Source: Internet
Author: User
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 ~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.