Python script arguments and Python call mysqldump

Source: Internet
Author: User
Tags python script

Tag:python   mysqldump    script     parameter    

Python script reference and Python call Mysqldump<pre name= "code" class= "Python" > #coding =utf-8import mysqldbimport sysimport os# Li Hongying Write, user Hunan CLV data segmentation using print ' Dump database: ', sys.argv[1] # #传入的第一个参数, database name print ' Dump table: ', sys.argv[2] # #传入的第二个参数, Table name Dbname=sys.argv[1]tablename=sys.argv[2] #同步数据值分析服务器2: # region_id:b C D edump101= ' Mysqldump-h10.33.2.71-uprobe- P5029 [email protected]--database ' +dbname+ '--table ' +tablename+ '-W ' region_id in (\ ' b\ ', \ ' c\ ', \ ' d\ ', \ ' e\ ') "| Mysql-h192.168.106.101-uprobe [email protected]-p5029 ' +dbnameresult=os.system (dump101) #同步数据值分析服务器3: # Region _id:f G H idump102= ' mysqldump-h10.33.2.71-uprobe-p5029 [email protected]--database ' +dbname+ '--table ' +tablenam E+ '-W ' region_id in (\ ' f\ ', \ ' g\ ', \ ' h\ ', \ ' i\ ') ' | Mysql-h192.168.106.102-uprobe [email protected]-p5029 ' +dbnameresult=os.system (dump102) #同步数据值分析服务器4: # Region _id:j K L M ndump103= ' mysqldump-h10.33.2.71-uprobe-p5029 [email protected]--database ' +dbname+ '--table ' +tablen Ame+ '-W "region_id in (\ ' j\ ', \ ' k\ ', \ ' l\ ', \ ' m\ ', \ ' n\ ')" | Mysql-h192.168.106.103-uprobe [email protected]-p5029 ' +dbnameresult=os.system (dump103)

Related Article

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.