def visit_create_table(self, tokens, running_scheme):
    if running_scheme and self._GetDescendants(running_scheme, 'shard'):
      self.AddError(tokens, 'CREATE should be run on all shards')

    table_spec = self._GetDescendants(tokens, 'table_spec')[0]
    try:
      table = self._db_schema.FindTableFromSpec(table_spec)
      self.AddError(tokens, 'Table %s already exists' % table)
    except schema.UnknownNameException:
      db = self._db_schema.FindDatabaseFromSpec(table_spec)
      table = db.AddTable(table_spec['table'][0])
      self.visit(tokens, table=table)

    engine = False
    for flag in self._GetDescendants(tokens, 'table_flags_definition'):
      if flag['table_flags_type'][0] not in ('type', 'engine'):
        continue
      engine = flag['table_flags_identifier'][0]
    engine = engine or self._db_schema.GetDefaultEngine()
    if engine.lower() not in self._allowed_engines:
      self.AddError(tokens, 'CREATE invalid engine: %s' % engine)
    table.SetEngine(engine)
dataset/ETHPy150Open google/mysql-tools/parser_lib/validator.py/CreateTableChecker.visit_create_table/original