[improvement](docs) add docs for alter catalog stmt (#14789)

This commit is contained in:
Yulei-Yang
2022-12-08 19:46:58 +08:00
committed by GitHub
parent b3b493fdef
commit 244bf84483
3 changed files with 165 additions and 0 deletions

View File

@ -0,0 +1,83 @@
---
{
"title": "ALTER-CATALOG",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
## ALTER-CATALOG
### Name
<version since="1.2">
ALTER CATALOG
</version>
### Description
This statement is used to set properties of the specified catalog. (administrator only)
1) Rename the catalog
```sql
ALTER CATALOG catalog_name RENAME new_catalog_name;
```
illustrate:
- The builtin catalog `internal` cannot be renamed
- Only the one who has at least Alter privilege can rename a catalog
- After renaming the catalog, use the REVOKE and GRANT commands to modify the appropriate user permissions
2) Modify / add properties for the catalog
```sql
ALTER CATALOG catalog_name SET PROPERTIES ('key1' = 'value1' [, 'key' = 'value2']);
```
Update values of specified keys. If a key does not exist in the catalog properties, it will be added.
illustrate:
- property `type` cannot be modified.
- properties of builtin catalog `internal` cannot be modified.
### Example
1. rename catalog ctlg_hive to hive
```sql
ALTER CATALOG ctlg_hive RENAME hive;
```
3. modify property `hive.metastore.uris` of catalog hive
```sql
ALTER CATALOG hive SET PROPERTIES ('hive.metastore.uris'='thrift://172.21.0.1:9083');
```
### Keywords
ALTER,CATALOG,RENAME,PROPERTY
### Best Practice

View File

@ -713,6 +713,7 @@
"type": "category",
"label": "Alter",
"items": [
"sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-CATALOG",
"sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-DATABASE",
"sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-BITMAP",
"sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-PARTITION",

View File

@ -0,0 +1,81 @@
---
{
"title": "ALTER-CATALOG",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
## ALTER-CATALOG
### Name
<version since="1.2">
ALTER CATALOG
</version>
### Description
该语句用于设置指定数据目录的属性。(仅管理员使用)
1) 重命名数据目录
```sql
ALTER CATALOG catalog_name RENAME new_catalog_name;
```
注意:
- `internal` 是内置数据目录,不允许重命名
-`catalog_name` 拥有 Alter 权限才允许对其重命名
- 重命名数据目录后,如需要,请使用 REVOKE 和 GRANT 命令修改相应的用户权限。
2) 设置数据目录属性
```sql
ALTER CATALOG catalog_name SET PROPERTIES ('key1' = 'value1' [, 'key' = 'value2']);
```
更新指定属性的值为指定的 value。如果 SET PROPERTIES 从句中的 key 在指定 catalog 属性中不存在,则新增此 key。
注意:
- 不可更改数据目录类型,即 `type` 属性
- 不可更改内置数据目录 `internal` 的属性
### Example
1. 将数据目录 ctlg_hive 重命名为 hive
```sql
ALTER CATALOG ctlg_hive RENAME hive;
```
3. 更新名为 hive 数据目录的属性 `hive.metastore.uris`
```sql
ALTER CATALOG hive SET PROPERTIES ('hive.metastore.uris'='thrift://172.21.0.1:9083');
```
### Keywords
ALTER,CATALOG,RENAME,PROPERTY
### Best Practice