
    L                     8   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	l
mZ  e	j                  e	j                  j                  e	j                  j                   e	j                  j"                         G d
 de	j$                               Zy)zImports 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                   &    e Zd ZdZed        Zd Zy)SqlzImports 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.
  c                    t        j                  | d       t        j                  | dd       | j	                  ddd       | j	                  d	d
t        j                  d      dd       t        j                  |        t        j                  |        t        j                  |        t        j                  |        y)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ArgszSql.Args)   s     ""6E:	L :  <   A.:  ; 
6"	F#	$$V,	##F+    c                 t    t        j                  t         j                        }t        j                  ||      S )z7Runs the command to import into the Cloud SQL instance.)r   	SqlClientAPI_VERSION_DEFAULTr
   RunCsvImportCommand)selfargsclients      r    RunzSql.RunH   s+     < <=F**488r"   N)__name__
__module____qualname____doc__staticmethodr!   r*    r"   r    r   r       s      , ,<9r"   r   N)r.   
__future__r   r   r   googlecloudsdk.api_lib.sqlr   googlecloudsdk.callioper   r   googlecloudsdk.command_lib.sqlr	   r
   ReleaseTracksReleaseTrackGABETAALPHACommandr   r0   r"   r    <module>r;      s{    '  ' / / ( 0 6 D%%(($*;*;*@*@%%++-)9$,, )9-)9r"   