ALTER SOURCE
The ALTER SOURCE
command modifies the definition of a source.
Syntax
alteroption
depends on the operation you want to perform on the source. For all supported clauses, see the sections below.
Clause
ADD COLUMN
Parameter or clause | Description |
---|---|
ADD COLUMN | This clause adds a column to the specified source. |
col_name | The name of the new column you want to add to the source. |
data_type | The data type of the newly added column. With the struct data type, you can create a nested table. Elements in a nested table need to be enclosed with angle brackets (<>). |
- To alter columns in a source created with a schema registry, see FORMAT and ENCODE options.
- You cannot add a primary key column to a source or table in RisingWave. To modify the primary key of a source or table, you need to recreate the table.
- You cannot remove a column from a source in RisingWave. If you intend to remove a column from a source, you’ll need to drop the source and create the source again.
RENAME TO
Parameter or clause | Description |
---|---|
RENAME TO | This clause changes the name of the source. |
new_source_name | The new name of the source. |
OWNER TO
Parameter or clause | Description |
---|---|
OWNER TO | This clause changes the owner of the source. |
new_user | The new owner you want to assign to the source. |
SET SCHEMA
Parameter or clause | Description |
---|---|
SET SCHEMA | This clause moves the source to a different schema. |
schema_name | The name of the schema to which the source will be moved. |
FORMAT and ENCODE options
At present, combined with the ALTER SOURCE
command, you can refresh the schema registry of a source by refilling the FORMAT and ENCODE options. For more details about these options, see FORMAT and ENCODE parameters.
Here is an example. Let’s assume the original FORMAT and ENCODE options are as follows:
Then you can refresh the schema registry by the following command:
Currently, it is not supported to modify the data_format
and data_encode
. Furthermore, when refreshing the schema registry of a source, it is not allowed to drop columns or change types.
Another way of refreshing the schema is using the REFRESH SCHEMA clause.
REFRESH SCHEMA
This is another way of refreshing the schema of sources when the FORMAT and ENCODE options are not changed.
For example, assume we have a source as follows:
Then we can refresh its schema with the following statement:
For more details about this example, see our test file.
SET SOURCE_RATE_LIMIT
Use this statement to modify the rate limit of a source. For the specific value of SOURCE_RATE_LIMIT
, refer to How to view runtime parameters.
For a newly created materialized view on a source with historical data e.g. Kafka source, it will backfill from
the source. The backfilling process will not be affected by the SOURCE_RATE_LIMIT
of the source.
To modify the rate limit of the backfilling process, please refer to SET BACKFILL_RATE_LIMIT.
Was this page helpful?