Rename table inside MapD. References to the old table are no longer
        valid.

        Parameters
        ----------
        new_name : string
        database : string

        Returns
        -------
        renamed : MapDTable
497230
def rename(self, new_name, database=None):
        
        m = ddl.fully_qualified_re.match(new_name)
        if not m and database is None:
            database = self._database

        statement = ddl.RenameTable(
            self._qualified_name, new_name, new_database=database
        )

        self._client._execute(statement)

        op = self.op().change_name(statement.new_qualified_name)
        return type(self)(op)
689052
def rename(self, old_name, new_name):
        """"""
        try:
            self.api.rename(mkey(old_name), mkey(new_name))
        except ResponseError, exc:
            if "no such key" in exc.args:
                raise KeyError(old_name)
            raise
568733
public function alterDbTable($model, $oldDbTableName, $newDbTableName)
    {
        if ($oldDbTableName === $newDbTableName) {
            return;
        }
        $this->renameTable($oldDbTableName, $newDbTableName);
    }
18131
function(name, newname) {
				var act = new NobleMachine(function() {
					act.toNext(db.query("SHOW COLUMNS FROM `" + tablename + "`;"));
				});

				act.next(function(result) {
					var sql = "ALTER TABLE `" + tablename + "` CHANGE `" + name + "` `" + newname + "`";

					result.forEach(function(coldatum) {
						if (coldatum['Field'] == name) {
							sql += " " + coldatum['Type'];
							
							if (coldatum['Null'] == 'NO') {
								sql += " NOT NULL";
							}

							if (coldatum['Key'] == 'PRI') {
								sql += " PRIMARY KEY";
							}

							sql += coldatum['Extra'];

							if (coldatum['Default'] != 'NULL') {
								sql += " DEFAULT " + coldatum['Default'];
							}
						}
					});
					sql += ";";

					act.toNext(db.query(sql));
				});

				me.act.next(act);
			}
1273428
def delete(self, table_name):
        
        dataset = Dataset(self, table_name)
        deleted = dataset.delete()
        if deleted:
            return deleted

        raise CartoException('''The table `{}` doesn't exist'''.format(table_name))
871448
def rename_keys(record: Mapping, key_map: Mapping) -> dict:
    """"""

    new_record = dict()

    for k, v in record.items():
        key = key_map[k] if k in key_map else k
        new_record[key] = v

    return new_record
1145082
public static function rename($table, $new_name)
	{
		$table = new Table($table);

		// To indicate that the table needs to be renamed, we will run the
		// "rename" command on the table instance and pass the instance to
		// the execute method as calling a Closure isn't needed.
		$table->rename($new_name);

		return static::execute($table);
	}
222642
private boolean upgradeDatabase(String name, String dbPath, boolean close) {
        Log.v(Log.TAG_DATABASE, "CouchbaseLite: Upgrading database (%s) at %s ...", name, dbPath);

        // if db with name already exists, not need to migrate. Simply remove old database
        Database db = getDatabase(name, false);
        if (!db.exists() && !name.equals("_replicator")) {

            // temporary database name for new db schema
            String tempName = name + ".tmp";

            // Create and open new CBLDatabase with temporary name:
            Database tmpDB = getDatabase(tempName, false);
            if (tmpDB == null) {
                Log.w(Log.TAG_DATABASE,
                        "Upgrade failed: Creating new db failed: %s", tempName);
                return false;
            }

            // upgradeDatabase() is called only if dbPath (old db version) exists. So presence of
            // temporary db indicates that previous upgrade crashed midway.
            if (tmpDB.exists()) {
                Log.v(Log.TAG_DATABASE, "Previous upgrade probably crashed midway. dbPath: " + dbPath);

                // rollback from temporary database to old database
                // NOTE: Deleting temporary db is not enough because `DatabaseUpgrade.importData()`
                //       move attachment files instead of copy files.
                DatabaseUpgrade upgrader = new DatabaseUpgrade(this, tmpDB, dbPath);
                upgrader.backOut();

                // temporary db is deleted by previous operation, reopen the temporary db.
                tmpDB = getDatabase(tempName, false);
                if (tmpDB == null) {
                    Log.w(Log.TAG_DATABASE, "Upgrade failed: Creating new db failed: %s", tempName);
                    return false;
                }
            }

            if (tmpDB.exists()) {
                // the temporary db should not exist. Just double check
                Log.w(Log.TAG_DATABASE,
                        "Upgrade failed: Failed to delete already existing db: %s", tempName);
                return false;
            }

            // Upgrade the old database into the new one:
            DatabaseUpgrade upgrader = new DatabaseUpgrade(this, tmpDB, dbPath);
            if (!upgrader.importData()) {
                upgrader.backOut();
                return false;
            }

            // close temporary database
            tmpDB.close();

            // rename temporary database name to new name
            File tmpPath = new File(pathForDatabaseNamed(tempName));
            File newPath = new File(pathForDatabaseNamed(name));
            if (!tmpPath.renameTo(newPath)) {
                Log.w(Log.TAG_DATABASE,
                        "Upgrade failed: Failed to rename db folder from temporary name: %s -> %s",
                        tmpPath, newPath);
                upgrader = new DatabaseUpgrade(this, getDatabase(tempName, false), dbPath);
                upgrader.backOut();
                return false;
            }

            // reopen db with name
            db = getDatabase(name, false);
            if (!db.exists()) {
                Log.w(Log.TAG_DATABASE,
                        "Upgrade failed: Failed to open the database after migrate: %s", name);
                return false;
            }
        }

        // close db if necessary
        if (close)
            db.close();

        // Remove old database file and its SQLite side files:
        moveSQLiteDbFiles(dbPath, null);

        if (dbPath.endsWith(kV1DBExtension)) {
            String oldAttachmentsName = FileDirUtils.getDatabaseNameFromPath(dbPath) + " attachments";
            File oldAttachmentsDir = new File(directoryFile, oldAttachmentsName);
            if (oldAttachmentsDir.exists())
                FileDirUtils.deleteRecursive(oldAttachmentsDir);
        }

        Log.v(Log.TAG_DATABASE, "    ...success!");
        return true;
    }
290757
public JacksonDBCollection<T, K> rename(String newName) throws MongoException {
        return rename(newName, false);
    }
280710
def rename(self, new_relation):
        
        # Relations store this stuff inside their `path` dict. But they
        # also store a table_name, and usually use it in their  .render(),
        # so we need to update that as well. It doesn't appear that
        # table_name is ever anything but the identifier (via .create())
        self.inner = self.inner.incorporate(
            path={
                'database': new_relation.inner.database,
                'schema': new_relation.inner.schema,
                'identifier': new_relation.inner.identifier
            },
            table_name=new_relation.inner.identifier
        )
83736
def set_table_name
      [self.old_name, self.new_name].each do |name|
        # make sure this table exists
        if self.table_exists?(name)
          # return true if we are already using this table
          return true if self.klass.table_name == name.to_s
          # otherwise we can change the table name
          self.klass.table_name = name
          return true
        end
      end
      self.raise_no_table_error
    end
632788
protected function _renameToTmp()
    {
        $tmpTableName = $this->_name;
        $tableNames = $this->_database->getTableNames();
        do {
            $tmpTableName .= '_bak';
        } while (in_array($tmpTableName, $tableNames));
        // Use quoteIdentifier() instead of prepareIdentifier() because the
        // temporary name is not identified as a keyword.
        $tmpTableName = $this->_database->quoteIdentifier($tmpTableName);
        $this->alter("RENAME TO $tmpTableName");
        return $tmpTableName;
    }
827295
def rename_column(self, model, old_name, new_name):
        """"""
        field = model._meta.fields[old_name]
        if isinstance(field, pw.ForeignKeyField):
            old_name = field.column_name
        self.__del_field__(model, field)
        field.name = field.column_name = new_name
        model._meta.add_field(new_name, field)
        if isinstance(field, pw.ForeignKeyField):
            field.column_name = new_name = field.column_name + '_id'
        self.ops.append(self.migrator.rename_column(model._meta.table_name, old_name, new_name))
        return model
665334
def rename(self, old_key, new_key):
        
        return lib.zhashx_rename(self._as_parameter_, old_key, new_key)
937356
def rename_column(old, nu)
      col = @origin.columns[old.to_s]

      definition = col[:type]
      definition += ' NOT NULL' unless col[:is_nullable]
      definition += " DEFAULT #{@connection.quote(col[:column_default])}" if col[:column_default]

      ddl('alter table `%s` change column `%s` `%s` %s' % [@name, old, nu, definition])
      @renames[old.to_s] = nu.to_s
    end
461019
def rename(name, new_name):
    '''
    
    '''
    current_info = info(name)
    if not current_info:
        raise CommandExecutionError('User \'{0}\' does not exist'.format(name))
    new_info = info(new_name)
    if new_info:
        raise CommandExecutionError(
            'User \'{0}\' already exists'.format(new_name)
        )
    _dscl(
        ['/Users/{0}'.format(name), 'RecordName', name, new_name],
        ctype='change'
    )
    # dscl buffers changes, sleep 1 second before checking if new value
    # matches desired value
    time.sleep(1)
    return info(new_name).get('RecordName') == new_name
1320870
def present(name, containment='NONE', options=None, **kwargs):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': ''}

    if __salt__['mssql.db_exists'](name, **kwargs):
        ret['comment'] = 'Database {0} is already present (Not going to try to set its options)'.format(name)
        return ret
    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = 'Database {0} is set to be added'.format(name)
        return ret

    db_created = __salt__['mssql.db_create'](name, containment=containment, new_database_options=_normalize_options(options), **kwargs)
    if db_created is not True:  # Non-empty strings are also evaluated to True, so we cannot use if not db_created:
        ret['result'] = False
        ret['comment'] += 'Database {0} failed to be created: {1}'.format(name, db_created)
        return ret
    ret['comment'] += 'Database {0} has been added'.format(name)
    ret['changes'][name] = 'Present'
    return ret