ó n[Qc@s\dZddlZddlZddlZddlmZddlmZddlmZm Z ddlm Z m Z ddlm Z m Z ddlmZdd lmZd Zd Zd Zd ddgZd„ZeejjejdƒeeƒZeeddeƒejdddddddddddddeƒejd d!dd"dedd#dd$ƒejd%d&dd"dd'dedd(ƒejd)d*dd"dd+dedd,ƒejd-dd"dd.dedd/ƒejd0dd"dd1dedd2ƒejd3dd"dd4dedd5ƒejd6dd"dedd7dd8ƒe eƒe eeƒe eƒejƒ\ZZe eƒye ej ƒZ!Wn)ek rÉZ"d9e"j#GHe$d:ƒnXe%eƒdkrìej&d;ƒnej'r ej(d k r d<GHnd e!kr:ej(d kr:d=GHe$d:ƒnd>e!kraej)rad?GHe$d:ƒnid@e!kdA6dBe!kdC6dDe!kdE6dFe!kdG6dHe!kdI6dJe!kdK6dLe!kdM6d>e!kdN6d e!kdO6ej'd16ej*dP6ej+d+6ej, dQ6ej(d6ej-d.6ej)d$6ej.dR6ej/dS6ej/dTkdU6ej0dV6ej1dW6ej2d46ej3d76Z4yeej5de4ƒZ7Wnej&dXƒnXgZ8xeD]Z9e8j:e9ƒq¬Wybej/dTkräejƒZ;nx!e8D]Z9ej<e7e9e4ƒqëWej/dTkr$ee;ƒnWn)ek rPZ"dYGe"j#GHe$d:ƒnXe$ƒdS(Zs… This file contains the import database utility which allows users to import metadata for objects in a database and data for tables. iÿÿÿÿN(tdbimport(tparse_connection(tsetup_common_optionst add_engines(tadd_skip_optionstcheck_skip_options(t add_verbositytcheck_verbosity(tadd_format_option(t UtilErrors MySQL Utilities - mysqldbimport s3mysqldbimport - import metadata and data from filessB%prog --server=user:pass@host:port:socket db1.csv db2.sql db3.gridtdatat definitionstbothcCsBtjƒ}t||dƒ}|dkr5d}nd|GHdS(sePrint the elapsed time to stdout (screen) start_test[in] The starting time of the test idiis Time: %6d N(ttimetint(t start_testt stop_testt display_time((s%..\utilities\scripts\mysqldbimport.pytprint_elapsed_time,s    isQthe input file format in either sql (default), grid, tab, csv, or vertical formattsqls-is--importtactiontstoretdestt import_typetdefaultthelpscontrol the import of either 'data' = only the table data for the tables in the database list, 'definitions' = import only the definitions for the objects in the database list, or 'both' = import the metadata followed by the data (default: import definitions)ttypetchoicetchoicess-ds --drop-firstt store_truesdrop database before importing.tdo_drops-bs --bulk-insertt bulk_inserts3use bulk insert statements for data (default:False)s-hs --no-headerst no_headerss#files do not contain column headerss--dryruntdryrunsgimport the files and generate the statements but do not execute them - useful for testing file validitys --skip-blobst skip_blobssdo not import blob data.s --skip-rpltskip_rpls$do not execute replication commands.s --skip-gtidt skip_gtids*do not execute the GTID_PURGED statements.s ERROR: %sis-You must specify at least one file to import.s;# WARNING: --skip-blobs option ignored for metadata import.sNERROR: You cannot use --import=data and --skip-data when importing table data.t create_dbs<ERROR: You cannot combine --drop-first and --skip=create_db.ttablest skip_tablestviewst skip_viewsttriggerst skip_triggerst procedurest skip_procst functionst skip_funcsteventst skip_eventstgrantst skip_grantst skip_createt skip_datatformattsingletquiett verbosityitdebugt new_enginet def_engines5Server connection values invalid or cannot be parsed.sERROR:(=t__doc__tostsysR tmysql.utilities.commandRtmysql.utilities.common.optionsRRRRRRRRtmysql.utilities.exceptionR tNAMEt DESCRIPTIONtUSAGEt_PERMITTED_IMPORTSRtpathtbasenametargvtparsertTruet add_optiontFalset parse_argstopttargst skip_objectstskipsteterrmsgtexittlenterrorR"RRR6R RR!R8R9R;R<R#R$toptionstservertNonet server_valuest file_listt file_nametappendRt import_file(((s%..\utilities\scripts\mysqldbimport.pytsÆ