
                         2   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  \R*                  \R,                  " \R.                  R0                  5       " S S\R2                  5      5       5       rg)zBQ copy command.    )absolute_import)division)unicode_literals)util)waiter)base)command_utils)hooks)	arg_utils)log)
properties)	resourcesc                   :    \ rS rSrSrSSSS.r\S 5       rS rS	r	g
)Copy    zBq Copy Command.z#Copy one BigQuery table to another.zJ            *{command}* Copies one BigQuery table to another.
            a            The following copies table `my-table`  to table `my-other-table`, in dataset `my-dataset`
          overwriting destination if it exists:

            $ {command} --source my-table --destination my-other-table --source-dataset my-dataset --overwrite
            )briefDESCRIPTIONEXAMPLESc                 .   [         R                  R                  U 5        [         R                  " SSSSSS9R                  U 5        [         R                  " SSSSS	9R                  U 5        [        R
                  " 5       S
   nUR                  U 5        g )Nz--overwrite
store_trueFz)Overwrite if the resource already exists.)actiondefaultrequiredhelpz--job-id z[A unique job ID to use for the request. If not specified a unique job id will be generated.)r   r   r   r   )r   
ASYNC_FLAGAddToParserArgumentr	   GetTableCopyResourceArgs)parserconcept_parsers     lib/surface/bq/tables/copy.pyArgs	Copy.Args1   s    OO'MM8:
 ;F+f:MMM	 *k&1";;=a@Nv&    c           	         [         R                  " UR                  5      n[        R                  " S5      nU" 5       nUR
                  =(       d1    [        R                  R                  R
                  R                  SS9nXTl
        [        R                  " S X5      n[        R                  " S X5      n[        R                  " USU5        [        R                  " USU5        [        R                   " 5       nUR"                  nUR"                  R%                  U5      nUR&                  R(                  R+                  5       n	UR&                  R,                  R+                  5       n
SR/                  U	R1                  5       R3                  5       U	R3                  5       U
R1                  5       R3                  5       U
R3                  5       5      nUR4                  (       d"  [6        R8                  " UR:                  SUS9  U$ UR<                  n[        R>                  " X|5      n[@        RB                  R+                  URD                  RF                  S	U0S
S9n[H        RJ                  " XUS9n[6        RL                  RO                  SR/                  U	R1                  5       R3                  5       U	R3                  5       U
R1                  5       R3                  5       U
R3                  5       5      5        U$ )NBigqueryJobsInsertRequestT)r   zjob.jobReference.jobIdzjob.jobReference.projectIdzCopying {0}:{1} to {2}:{3}.Job)kinddetails	projectIdzbigquery.jobs)params
collection)polleroperation_refmessagezCopied {0}:{1} to {2}:{3}.)(r
   JobIdProcessorjob_idapi_utilGetApiMessageprojectr   VALUEScoreGetr+   r	   ProcessTableCopyConfigurationProcessTableCopyOverwriter   SetFieldInMessageGetApiClientjobsInsertCONCEPTSsourceParsedestinationformatParentNameasync_r   CreatedResourceidtablesBqJobPollerr   REGISTRYjobReferencejobIdr   WaitForstatusPrint)selfargsr2   requests_typerequestr5   clientjob_servicejob
source_refdestination_refcopy_messageresult_servicer.   job_refresults                   r"   RunCopy.RunD   sF   !!$++.F**+FGMoGllOj//44<<@@$@OG99$NG55dDJG)A6J)EwO""$F++K
++

W
%C%%++-Jmm//557O077  "JOO$5 %%')=)=)?AL ;;	#&&ulCj]]N&&{CF  &&s'7'7'='=/:G.D2A ' CG ^^6$02F JJ188  "JOO$5 %%')=)=)?A B Mr%    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr#   r^   __static_attributes__r`   r%   r"   r   r       s4     4- ' '$$r%   r   N)re   
__future__r   r   r   googlecloudsdk.api_lib.bqr   r3   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   googlecloudsdk.command_lib.bqr	   r
   $googlecloudsdk.command_lib.util.apisr   googlecloudsdk.corer   r   r   UniverseCompatibleReleaseTracksReleaseTrackALPHACommandr   r`   r%   r"   <module>ru      su     &  ' 6 . ( 7 / : # * ) D%%++,F4<< F - Fr%   