def Args(parser): """Args 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. """ base.ASYNC_FLAG.AddToParser(parser) parser.add_argument('instance', completer=flags.InstanceCompleter, help='Cloud SQL instance ID.') parser.add_argument( 'uri', help='The path to the file in Google Cloud Storage where the export ' 'will be stored. The URI is in the form gs://bucketName/fileName. ' 'If the file already exists, the operation fails. If the filename ' 'ends with .gz, the contents are compressed.') flags.AddDatabaseList(parser, flags.DEFAULT_DATABASE_LIST_EXPORT_HELP_TEXT) parser.add_argument( '--table', '-t', type=arg_parsers.ArgList(min_length=1), metavar='TABLE', required=False, help='Tables to export from the specified database. If you specify ' 'tables, specify one and only one database. For Postgres instances, ' 'only one table can be exported at a time.')
def AddBaseExportFlags( parser, gz_supported=True, database_required=False, database_help_text=flags.DEFAULT_DATABASE_LIST_EXPORT_HELP_TEXT): """Adds the base export flags to the parser. Args: parser: The current argparse parser to add these flags to. gz_supported: Boolean, specifies whether gz compression is supported. database_required: Boolean, specifies whether the database flag is required. database_help_text: String, specifies the help text for the database flag. """ base.ASYNC_FLAG.AddToParser(parser) flags.AddInstanceArgument(parser) uri_help_text = ('The path to the file in Google Cloud Storage where the ' 'export will be stored. The URI is in the form ' 'gs://bucketName/fileName. If the file already exists, the ' 'operation fails.') if gz_supported: uri_help_text = uri_help_text + (' If the filename ends with .gz, the ' 'contents are compressed.') flags.AddUriArgument(parser, uri_help_text) flags.AddDatabaseList(parser, database_help_text, database_required)
def AddBaseExportFlags(parser): base.ASYNC_FLAG.AddToParser(parser) flags.AddInstanceArgument(parser) flags.AddUriArgument( parser, 'The path to the file in Google Cloud Storage where the export ' 'will be stored. The URI is in the form gs://bucketName/fileName. ' 'If the file already exists, the operation fails. If the filename ' 'ends with .gz, the contents are compressed.') flags.AddDatabaseList(parser, flags.DEFAULT_DATABASE_LIST_EXPORT_HELP_TEXT)
def AddBaseExportFlags(parser): base.ASYNC_FLAG.AddToParser(parser) flags.AddInstanceArgument(parser) flags.AddUriArgument( parser, 'The path to the file in Google Cloud Storage where the export ' 'will be stored. The URI is in the form gs://bucketName/fileName. ' 'If the file already exists, the operation fails. If the filename ' 'ends with .gz, the contents are compressed.') flags.AddDatabaseList( parser, 'Database (for example, guestbook) from which the export is ' 'made. If unspecified, all databases are exported.')