rename_table Action

Implement the rename_table DoAction to support ALTER TABLE RENAME TO statements for renaming tables in your database.

The rename_table action renames an existing table. This action is invoked when executing an ALTER TABLE ... RENAME TO SQL statement.

SQL Example

ALTER TABLE example.main.employees RENAME TO staff;
ALTER TABLE example.main.old_data RENAME TO archive_data;

Input Parameters

The action receives a single msgpack-serialized parameter:

// The base class for all alter parameters.
struct AirportAlterBase
{
  //! Catalog name to alter
  std::string catalog;
  //! Schema name to alter
  std::string schema;
  //! Entry name to alter
  std::string name;
  bool ignore_not_found;
};

struct AirportAlterTableRenameTableParameters : AirportAlterBase
{
  std::string new_table_name;

  MSGPACK_DEFINE_MAP(catalog, schema, name, new_table_name);
};

Return Value

The action must return a single FlightInfo structure representing the renamed table. The app_metadata field must be populated appropriately to identify the flight as a table with the new name.