ALTER Statements
You can use the ALTER statements to modify already registered databases, tables, and function definitions in the chosen catalogs. There are different limitations for databases, tables and functions when altering them.
For more information about ALTER
statements, see the Apache Flink documentation.
ALTER DATABASE
Database properties can be changed, but databases cannot be renamed. You can use
DROP
and CREATE
instead of
renaming.tableEnv.sqlUpdate("CREATE DATABASE sample_database");
tableEnv.sqlUpdate("ALTER DATABASE sample_database SET ('key1'='value1')");
ALTER TABLE
Tables can be renamed and table properties can also be
changed.
tableEnv.sqlUpdate("CREATE TABLE sample_table(c1 STRING) WITH ('key1'='value1')");
tableEnv.sqlUpdate("ALTER TABLE sample_table SET ('key1'='value2')");
tableEnv.sqlUpdate("ALTER TABLE sample_table RENAME TO sample_table2");
ALTER FUNCTION
New identifiers, which are full classpath for JAVA/SCALA objects, can be assigned to
registered
functions.
tableEnv.sqlUpdate("CREATE FUNCTION myudf AS 'com.example.MyUdf'");
tableEnv.sqlUpdate("ALTER FUNCTION myudf AS 'com.example.MyUdf'");