Esempio n. 1
0
  def Run(self, args):
    """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
    op = databases.UpdateDdl(
        args.instance, args.database, flags.FixDdl(args.ddl or []))
    if args.async:
      return op
    return database_operations.Await(op, 'DDL updating')
Esempio n. 2
0
  def Run(self, args):
    """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
    op = databases.UpdateDdl(args.CONCEPTS.database.Parse(),
                             flags.SplitDdlIntoStatements(args.ddl or []))
    if args.async_:
      return log.status.Print(
          'Schema update in progress. Operation name={}'.format(op.name))
    return database_operations.Await(op, 'Schema updating')
Esempio n. 3
0
 def testUpdateDdl(self):
     statements = ['a', 'b']
     response = self.msgs.Operation()
     ref = resources.REGISTRY.Parse(
         'dbId',
         params={
             'instancesId': 'insId',
             'projectsId': self.Project(),
         },
         collection='spanner.projects.instances.databases')
     self.client.projects_instances_databases.UpdateDdl.Expect(
         request=self.msgs.
         SpannerProjectsInstancesDatabasesUpdateDdlRequest(
             database=ref.RelativeName(),
             updateDatabaseDdlRequest=self.msgs.UpdateDatabaseDdlRequest(
                 statements=statements)),
         response=response)
     self.assertEqual(response, databases.UpdateDdl(ref, statements))