Exemplo n.º 1
0
def AddBaseImportFlags(parser,
                       filetype,
                       gz_supported=True,
                       user_supported=True):
    """Adds the base flags for importing data.

  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.
    filetype: String, description of the file type being imported.
    gz_supported: Boolean, if True then .gz compressed files are supported.
    user_supported: Boolean, if True then a Postgres user can be specified.
  """
    base.ASYNC_FLAG.AddToParser(parser)
    flags.AddInstanceArgument(parser)
    uri_help_text = (
        'Path to the {filetype} file in Google Cloud Storage from '
        'which the import is made. The URI is in the form '
        '`gs://bucketName/fileName`.')
    if gz_supported:
        uri_help_text = uri_help_text + (
            ' Compressed gzip files (.gz) are also '
            'supported.')
    flags.AddUriArgument(parser, uri_help_text.format(filetype=filetype))

    if user_supported:
        flags.AddUser(parser, 'PostgreSQL user for this import operation.')
Exemplo n.º 2
0
def AddBaseImportFlags(parser):
    base.ASYNC_FLAG.AddToParser(parser)
    flags.AddInstanceArgument(parser)
    flags.AddUriArgument(
        parser,
        'Path to the MySQL dump file in Google Cloud Storage from which'
        ' the import is made. The URI is in the form gs://bucketName/fileName.'
        ' Compressed gzip files (.gz) are also supported.')
    flags.AddUser(parser, 'The PostgreSQL user for this import operation')