
    L                     8   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  \	R                  " \	R                  R                  \	R                  R                   \	R                  R"                  5       " S
 S\	R$                  5      5       rg)Imports data into a Cloud SQL instance from a CSV file.

Imports data into a Cloud SQL instance from a plain text file in a Google
Cloud Storage bucket with one line per row and comma-separated fields.
    )absolute_import)division)unicode_literals)api_util)arg_parsers)base)flags)import_utilc                   .    \ rS rSrSr\S 5       rS rSrg)Sql    r   c                 v   [         R                  " U SS9  [        R                  " U SSS9  U R	                  SSSS9  U R	                  S	S
[
        R                  " SS9SSS9  [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        g)zArgs is called by calliope to gather arguments for this command.

Args:
  parser: An argparse parser that you can use to add arguments that go
      on the command line after this command. Positional arguments are
      allowed.
CSV)filetypezBThe database (for example, guestbook) to which the import is made.T)requiredz--tablez+The database table to import csv file into.)r   helpz	--columnsF   )
min_lengthCOLUMNSzThe columns to import from csv file. These correspond to actual database columns to import. If not set, all columns from csv file are imported to corresponding database columns.)r   typemetavarr   N)r   AddBaseImportFlagsr
   AddDatabaseadd_argumentr   ArgListAddQuoteArgumentAddEscapeArgumentAddFieldsDelimiterArgumentAddLinesDelimiterArgument)parsers    lib/surface/sql/import/csv.pyArgsSql.Args)   s     ""6E:	L :  <   A.:  ; 
6"	F#	$$V,	##F+    c                 v    [         R                  " [         R                  5      n[        R                  " X5      $ )z7Runs the command to import into the Cloud SQL instance.)r   	SqlClientAPI_VERSION_DEFAULTr   RunCsvImportCommand)selfargsclients      r"   RunSql.RunH   s)     < <=F**488r%    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr#   r-   __static_attributes__r/   r%   r"   r   r       s      , ,<9r%   r   N)r4   
__future__r   r   r   googlecloudsdk.api_lib.sqlr   googlecloudsdk.callioper   r	   googlecloudsdk.command_lib.sqlr
   r   ReleaseTracksReleaseTrackGABETAALPHACommandr   r/   r%   r"   <module>rA      sy    '  ' / / ( 0 6 D%%(($*;*;*@*@%%++-)9$,, )9-)9r%   