This is an automated email from the ASF dual-hosted git repository. kassiez pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push: new 312f8f5581b [doc]modify catalog docs (#1903) 312f8f5581b is described below commit 312f8f5581b8e89bb75cdfc76bbe58f4b28c3cb5 Author: ZhenchaoXu <49646212+i...@users.noreply.github.com> AuthorDate: Wed Feb 5 18:49:18 2025 +0800 [doc]modify catalog docs (#1903) modify catalog docs ## Versions - [x] dev - [x] 3.0 - [x] 2.1 - [ ] 2.0 ## Languages - [x] Chinese - [x] English ## Docs Checklist - [ ] Checked by AI - [ ] Test Cases Built --- .../sql-statements/catalog/ALTER-CATALOG.md | 95 +++++++++++++--------- .../sql-statements/catalog/CREATE-CATALOG.md | 30 +++++-- .../sql-statements/catalog/DROP-CATALOG.md | 22 +++-- docs/sql-manual/sql-statements/catalog/REFRESH.md | 38 ++++++--- .../sql-statements/catalog/SHOW-CATALOG.md | 50 +++++++----- .../sql-statements/catalog/SHOW-CREATE-CATALOG.md | 45 ++++++---- .../sql-statements/catalog/ALTER-CATALOG.md | 93 ++++++++++++--------- .../sql-statements/catalog/CREATE-CATALOG.md | 38 ++++++--- .../sql-statements/catalog/DROP-CATALOG.md | 26 +++--- .../sql-manual/sql-statements/catalog/REFRESH.md | 40 +++++---- .../sql-statements/catalog/SHOW-CATALOG.md | 54 +++++++----- .../sql-statements/catalog/SHOW-CREATE-CATALOG.md | 50 +++++++----- .../sql-statements/catalog/ALTER-CATALOG.md | 91 ++++++++++++--------- .../sql-statements/catalog/CREATE-CATALOG.md | 38 ++++++--- .../sql-statements/catalog/DROP-CATALOG.md | 26 +++--- .../sql-manual/sql-statements/catalog/REFRESH.md | 43 ++++++---- .../sql-statements/catalog/SHOW-CATALOG.md | 54 +++++++----- .../sql-statements/catalog/SHOW-CREATE-CATALOG.md | 46 +++++++---- .../sql-statements/catalog/ALTER-CATALOG.md | 93 ++++++++++++--------- .../sql-statements/catalog/CREATE-CATALOG.md | 39 +++++---- .../sql-statements/catalog/DROP-CATALOG.md | 26 +++--- .../sql-manual/sql-statements/catalog/REFRESH.md | 42 ++++++---- .../sql-statements/catalog/SHOW-CATALOG.md | 51 ++++++++---- .../sql-statements/catalog/SHOW-CREATE-CATALOG.md | 50 +++++++----- .../sql-statements/catalog/ALTER-CATALOG.md | 94 ++++++++++++--------- .../sql-statements/catalog/CREATE-CATALOG.md | 31 ++++--- .../sql-statements/catalog/DROP-CATALOG.md | 26 +++--- .../sql-manual/sql-statements/catalog/REFRESH.md | 44 ++++++---- .../sql-statements/catalog/SHOW-CATALOG.md | 46 +++++++---- .../sql-statements/catalog/SHOW-CREATE-CATALOG.md | 43 +++++++--- .../sql-statements/catalog/ALTER-CATALOG.md | 95 +++++++++++++--------- .../sql-statements/catalog/CREATE-CATALOG.md | 30 +++++-- .../sql-statements/catalog/DROP-CATALOG.md | 25 +++--- .../sql-manual/sql-statements/catalog/REFRESH.md | 40 +++++---- .../sql-statements/catalog/SHOW-CATALOG.md | 50 +++++++----- .../sql-statements/catalog/SHOW-CREATE-CATALOG.md | 42 +++++++--- 36 files changed, 1073 insertions(+), 673 deletions(-) diff --git a/docs/sql-manual/sql-statements/catalog/ALTER-CATALOG.md b/docs/sql-manual/sql-statements/catalog/ALTER-CATALOG.md index e6435151dba..b13d52e4514 100644 --- a/docs/sql-manual/sql-statements/catalog/ALTER-CATALOG.md +++ b/docs/sql-manual/sql-statements/catalog/ALTER-CATALOG.md @@ -25,72 +25,87 @@ specific language governing permissions and limitations under the License. --> +## Description +This statement is used to set properties of the specified catalog. +## Syntax +1) Rename the catalog -## Description + ```sql + ALTER CATALOG <catalog_name> RENAME <new_catalog_name>; + ``` -This statement is used to set properties of the specified catalog. (administrator only) +2) Modify / Add properties for the catalog -1) Rename the catalog + ```sql + ALTER CATALOG <catalog_name> SET PROPERTIES ('<key>' = '<value>' [, ... ]); + ``` -```sql -ALTER CATALOG catalog_name RENAME new_catalog_name; -``` +3) Modify comment for the catalog -illustrate: + ```sql + ALTER CATALOG <catalog_name> MODIFY COMMENT "<new catalog comment>"; + ``` -- 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 +## Required Parameters -2) Modify / add properties for the catalog +**1. `<catalog_name>`** -```sql -ALTER CATALOG catalog_name SET PROPERTIES ('key1' = 'value1' [, 'key' = 'value2']); -``` +The name of the catalog that should be modified -Update values of specified keys. If a key does not exist in the catalog properties, it will be added. +**2. `<new_catalog_name>`** -illustrate: +New catalog name after modification -- property `type` cannot be modified. -- properties of builtin catalog `internal` cannot be modified. +**3. `'<key>' = '<value>'`** -3) Modify comment for the catalog +The key and value of the catalog properties that need to be modified / added -```sql -ALTER CATALOG catalog_name MODIFY COMMENT "new catalog comment"; -``` +**4. `<new catalog comment>`** -illustrate: +Modified catalog comment -- The builtin catalog `internal` cannot be modified -## Example +## Access Control Requirements +| Privilege | Object | Notes | +|:-----------|:--------|:------------------------------------------| +| ALTER_PRIV | Catalog | The ALTER_PRIV of the catalog is required | -1. rename catalog ctlg_hive to hive +## Usage Notes - ```sql - ALTER CATALOG ctlg_hive RENAME hive; - ``` +1) Rename the catalog +- 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 -3. modify property `hive.metastore.uris` of catalog hive +2) Modify / Add properties for the catalog - ```sql - ALTER CATALOG hive SET PROPERTIES ('hive.metastore.uris'='thrift://172.21.0.1:9083'); - ``` +- property `type` cannot be modified. +- properties of builtin catalog `internal` cannot be modified. +- Update values of specified keys. If a key does not exist in the catalog properties, it will be added. -4. modify comment of catalog hive +3) Modify comment for the catalog + +- The builtin catalog `internal` cannot be modified + +## Example + +1. rename catalog ctlg_hive to hive - ```sql - ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; - ``` + ```sql + ALTER CATALOG ctlg_hive RENAME hive; + ``` -## Keywords +2. modify property `hive.metastore.uris` of catalog hive -ALTER,CATALOG,RENAME,PROPERTY + ```sql + ALTER CATALOG hive SET PROPERTIES ('hive.metastore.uris'='thrift://172.21.0.1:9083'); + ``` -## Best Practice +3. modify comment of catalog hive + ```sql + ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; + ``` diff --git a/docs/sql-manual/sql-statements/catalog/CREATE-CATALOG.md b/docs/sql-manual/sql-statements/catalog/CREATE-CATALOG.md index 7167606ecb7..49d57db8689 100644 --- a/docs/sql-manual/sql-statements/catalog/CREATE-CATALOG.md +++ b/docs/sql-manual/sql-statements/catalog/CREATE-CATALOG.md @@ -24,18 +24,35 @@ specific language governing permissions and limitations under the License. --> - ## Description This statement is used to create an external catalog -Syntax: +## Syntax ```sql -CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] - PROPERTIES ("key"="value", ...); +CREATE CATALOG [IF NOT EXISTS] <catalog_name> [ COMMENT "<comment>"] + PROPERTIES ("<key>"="<value>" [, ... ]); ``` +## Required Parameters + +**1. `<catalog_name>`** +The name of the catalog to be created. + +**2. `"<key>"="<value>"`** +The parameters for creating the catalog. + +## Optional Parameters + +**1. `<comment>`** +The comment for the catalog to be created. + +## Access Control Requirements +| Privilege | Object | Notes | +|:------------|:--------|:----------------------------------------------------------------------| +| CREATE_PRIV | Catalog | The CREATE_PRIV permission for the corresponding catalog is required. | + ## Example 1. Create catalog hive @@ -162,9 +179,4 @@ CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] ); ``` -## Keywords - -CREATE, CATALOG - -## Best Practice diff --git a/docs/sql-manual/sql-statements/catalog/DROP-CATALOG.md b/docs/sql-manual/sql-statements/catalog/DROP-CATALOG.md index b9145354b88..173413f6d58 100644 --- a/docs/sql-manual/sql-statements/catalog/DROP-CATALOG.md +++ b/docs/sql-manual/sql-statements/catalog/DROP-CATALOG.md @@ -24,18 +24,27 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement is used to delete the external catalog. -Syntax: +## Syntax ```sql -DROP CATALOG [I EXISTS] catalog_name; +DROP CATALOG [IF EXISTS] <catalog_name>; ``` +## Required Parameters + +**1. `<catalog_name>`** +The name of the catalog to be dropped. + +## Access Control Requirements +| Privilege | Object | Notes | +|:----------|:--------|:--------------------------------------------------------------------| +| DROP_PRIV | Catalog | The DROP_PRIV permission for the corresponding catalog is required. | + + ## Example 1. Drop catalog hive @@ -44,9 +53,4 @@ DROP CATALOG [I EXISTS] catalog_name; DROP CATALOG hive; ``` -## Keywords - -DROP, CATALOG - -## Best Practice diff --git a/docs/sql-manual/sql-statements/catalog/REFRESH.md b/docs/sql-manual/sql-statements/catalog/REFRESH.md index 79e3e9d26c0..54f3990e847 100644 --- a/docs/sql-manual/sql-statements/catalog/REFRESH.md +++ b/docs/sql-manual/sql-statements/catalog/REFRESH.md @@ -24,23 +24,40 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement refreshes the metadata of the specified Catalog/Database/Table. -syntax: +## Syntax ```sql -REFRESH CATALOG catalog_name; -REFRESH DATABASE [catalog_name.]database_name; -REFRESH TABLE [catalog_name.][database_name.]table_name; +REFRESH CATALOG <catalog_name>; +REFRESH DATABASE [<catalog_name>.]<database_name>; +REFRESH TABLE [[<catalog_name>.]<database_name>.]<table_name>; ``` -When the Catalog is refreshed, the object-related Cache is forced to be invalidated. +## Required Parameters + +**1. `<catalog_name>`** + +The name of the catalog that needs to be refreshed. + +**2. `[<catalog_name>.]<database_name>`** + +The name of the database within the catalog that needs to be refreshed. -Including Partition Cache, Schema Cache, File Cache, etc. +**3. `[[<catalog_name>.]<database_name>.]<table_name>`** + +The name of the table within the catalog that needs to be refreshed. + +## Access Control Requirements +| Privilege | Object | Notes | +|:---------------------------------------------------------------------------------------------|:--------|:------------------------------------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | One of the above permissions is required. | + + +## Usage Notes +When the Catalog is refreshed, the object-related Cache is forced to be invalidated. Including Partition Cache, Schema Cache, File Cache, etc. ## Example @@ -65,9 +82,4 @@ Including Partition Cache, Schema Cache, File Cache, etc. REFRESH TABLE table1; ``` -## Keywords - -REFRESH, CATALOG, DATABASE, TABLE - -## Best Practice diff --git a/docs/sql-manual/sql-statements/catalog/SHOW-CATALOG.md b/docs/sql-manual/sql-statements/catalog/SHOW-CATALOG.md index b252c074ef3..6bfb912f259 100644 --- a/docs/sql-manual/sql-statements/catalog/SHOW-CATALOG.md +++ b/docs/sql-manual/sql-statements/catalog/SHOW-CATALOG.md @@ -24,16 +24,14 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement is used for view created catalogs -Syntax: +## Syntax ```sql -SHOW CATALOGS [LIKE] +SHOW CATALOGS [LIKE <catalog_name>] ``` illustrate: @@ -41,41 +39,55 @@ illustrate: 1. LIKE: Fuzzy query can be performed according to the catalog name -Return result: +## Optional Parameters + +**1. `<catalog_name>`** + +The name of the catalog to be displayed. + +## Return Value + +| Column Name | Description | +|---|---| +| CatalogId | Unique ID of the data catalog | +| CatalogName | Name of the data catalog. The default built-in catalog is named "internal" and cannot be modified. | +| Type | Type of the data catalog | +| IsCurrent | Indicates whether it is the currently active data catalog | +| CreateTime | Creation time | +| LastUpdateTime | Last updated time | +| Comment | comments about the catalog | -* CatalogId: Unique ID of the catalog -* CatalogName: Catalog name. where "internal" is the default built-in catalog, which cannot be modified. -* Type: Catalog type. -* IsCurrent: Show yes on the line of current using catalog. +## Access Control Requirements +| Privilege | Object | Notes | +|:---------------------------------------------------------------------------------------------|:--------|:------------------------------------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | One of the above permissions is required. | -## Example + +## Examples 1. View the data catalogs that have been created currently ```sql SHOW CATALOGS; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | | 0 | internal | internal | yes | UNRECORDED | NULL | Doris internal catalog | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` + ``` 2. Fuzzy query by catalog name ```sql SHOW CATALOGS LIKE 'hi%'; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` - -## Keywords - -SHOW, CATALOG, CATALOGS - -## Best Practice - + ``` \ No newline at end of file diff --git a/docs/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md b/docs/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md index 8da2b8f6e74..ea08aeaf1ab 100644 --- a/docs/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md +++ b/docs/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md @@ -25,34 +25,49 @@ specific language governing permissions and limitations under the License. --> - - - ## Description This statement shows the creating statement of a doris catalog. -grammar: +## Syntax ```sql -SHOW CREATE CATALOG catalog_name; +SHOW CREATE CATALOG <catalog_name>; ``` -illustrate: +## Required Parameters -- `catalog_name`: The name of the catalog which exist in doris. +**1. `<catalog_name>`** -## Example +The name of the catalog whose creation statement needs to be viewed. -1. View the creating statement of the hive catalog in doris +## Access Control Requirements +| Privilege | Object | Notes | +|:---------------------------------------------------------------------------------------------|:--------|:------------------------------------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | One of the above permissions is required. | - ```sql - SHOW CREATE CATALOG hive; - ``` -## Keywords +## Example -SHOW, CREATE, CATALOG +1. View the creating statement of the oracle catalog in doris -## Best Practice +```sql + SHOW CREATE CATALOG oracle; + ``` + ```sql + +---------+----------------------------------------------------------------------------------------------------------------------+ + | Catalog | CreateCatalog | + +---------+----------------------------------------------------------------------------------------------------------------------+ + | oracle | + CREATE CATALOG `oracle` PROPERTIES ( + "user" = "XXX", + "type" = "jdbc", + "password" = "*XXX", + "jdbc_url" = "XXX", + "driver_url" = "XXX", + "driver_class" = "oracle.jdbc.driver.OracleDriver", + "checksum" = "XXX" + ); | + +---------+----------------------------------------------------------------------------------------------------------------------+ + ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/ALTER-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/ALTER-CATALOG.md index ec39807a322..cebf02d5fc3 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/ALTER-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/ALTER-CATALOG.md @@ -24,66 +24,83 @@ specific language governing permissions and limitations under the License. --> +## 描述 +该语句用于设置指定数据目录的属性。 +## 语法 +1) 重命名数据目录 -## 描述 + ```sql + ALTER CATALOG <catalog_name> RENAME <new_catalog_name>; + ``` -该语句用于设置指定数据目录的属性。(仅管理员使用) +2) 设置数据目录属性 -1) 重命名数据目录 + ```sql + ALTER CATALOG <catalog_name> SET PROPERTIES ('<key>' = '<value>' [, ... ]); + ``` + +3) 修改数据目录注释 + + ```sql + ALTER CATALOG <catalog_name> MODIFY COMMENT "<new catalog comment>"; + ``` + +## 必选参数 + +**1. `<catalog_name>`** + +需要修改的 Catalog 名称 + +**2. `<new_catalog_name>`** + +修改后的新 Catalog 名称 + +**3. `'<key>' = '<value>'`** -```sql -ALTER CATALOG catalog_name RENAME new_catalog_name; -``` -注意: +需要修改/添加的 Catalog 属性的key和value + +**4. `<new catalog comment>`** + +修改后的 Catalog 注释 + +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:--------------|:-------------|:--------------------------| +| ALTER_PRIV | Catalog | 需要有对应catalog的ALTER_PRIV权限 | + +## 注意事项 + +1) 重命名数据目录 - `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` 的属性 +- 更新指定属性的值为指定的 value。如果 SET PROPERTIES 从句中的 key 在指定 catalog 属性中不存在,则新增此 key。 3) 修改数据目录注释 - -```sql -ALTER CATALOG catalog_name MODIFY COMMENT "new catalog comment"; -``` - -注意: - `internal` 是内置数据目录,不允许修改注释 ## 示例 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'); -``` - -4. 更改名为 hive 数据目录的注释 + ```sql + ALTER CATALOG ctlg_hive RENAME hive; + ``` -```sql -ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; -``` +2. 更新名为 hive 数据目录的属性 `hive.metastore.uris` -## 关键词 + ```sql + ALTER CATALOG hive SET PROPERTIES ('hive.metastore.uris'='thrift://172.21.0.1:9083'); + ``` -ALTER,CATALOG,RENAME,PROPERTY +3. 更改名为 hive 数据目录的注释 -### 最佳实践 + ```sql + ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; + ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/CREATE-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/CREATE-CATALOG.md index e92035e4c6c..2541f05f904 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/CREATE-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/CREATE-CATALOG.md @@ -24,25 +24,43 @@ specific language governing permissions and limitations under the License. --> - - - - ## 描述 该语句用于创建外部数据目录(catalog) -语法: +## 语法 ```sql -CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] - PROPERTIES ("key"="value", ...); +CREATE CATALOG [IF NOT EXISTS] <catalog_name> [ COMMENT "<comment>"] + PROPERTIES ("<key>"="<value>" [, ... ]); ``` * hms:Hive MetaStore * es:Elasticsearch * jdbc:数据库访问的标准接口 (JDBC), 当前支持 MySQL 和 PostgreSQL + +## 必选参数 + +**1. `<catalog_name>`** + +需要创建 catalog 的名字 + +**2. `"<key>"="<value>"`** + +需要创建 catalog 的参数 + +## 可选参数 + +**1. `<comment>`** + +需要创建 catalog 的注释 + +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:--------------|:-----------|:---------------------------| +| CREATE_PRIV | Catalog | 需要有对应catalog的CREATE_PRIV权限 | + ## 示例 1. 新建数据目录 hive @@ -169,9 +187,3 @@ CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] ); ``` -## 关键词 - -CREATE, CATALOG - -### 最佳实践 - diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/DROP-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/DROP-CATALOG.md index 2c82a150985..ea127b8c92f 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/DROP-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/DROP-CATALOG.md @@ -24,29 +24,31 @@ specific language governing permissions and limitations under the License. --> - - ## 描述 该语句用于删除外部数据目录(catalog) -语法: +## 语法 ```sql -DROP CATALOG [IF EXISTS] catalog_name; +DROP CATALOG [IF EXISTS] <catalog_name>; ``` -## 示例 +## 必选参数 -1. 删除数据目录 hive +**1. `<catalog_name>`** - ```sql - DROP CATALOG hive; - ``` +需要删除 catalog 的名字 -## 关键词 +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:--------------|:-----------|:-------------------------| +| DROP_PRIV | Catalog | 需要有对应catalog的DROP_PRIV权限 | -DROP, CATALOG +## 示例 -### 最佳实践 +1. 删除数据目录 hive + ```sql + DROP CATALOG hive; + ``` \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/REFRESH.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/REFRESH.md index 7ed3adcff63..747351a6725 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/REFRESH.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/REFRESH.md @@ -24,26 +24,41 @@ specific language governing permissions and limitations under the License. --> +## 描述 +该语句用于刷新指定 Catalog/Database/Table 的元数据。 +## 语法 +```sql +REFRESH CATALOG <catalog_name>; +REFRESH DATABASE [<catalog_name>.]<database_name>; +REFRESH TABLE [[<catalog_name>.]<database_name>.]<table_name>; +``` +## 必选参数 -## 描述 +**1. `<catalog_name>`** -该语句用于刷新指定 Catalog/Database/Table 的元数据。 +需要刷新的 catalog 的名字 -语法: +**2. `[<catalog_name>.]<database_name>`** + +需要刷新的 catalog 里面 database 的名字 + +**3. `[[<catalog_name>.]<database_name>.]<table_name>`** + +需要刷新的 catalog 里面 table 的名字 -```sql -REFRESH CATALOG catalog_name; -REFRESH DATABASE [catalog_name.]database_name; -REFRESH TABLE [catalog_name.][database_name.]table_name; -``` -刷新 Catalog 的同时,会强制使对象相关的 Cache 失效。 +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:---------------------------------------------------------------------------------------------|:-----------|:---------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | 需要有上述权限中的一种就可以 | -包括 Partition Cache、Schema Cache、File Cache 等。 + +## 注意事项 +刷新 Catalog 的同时,会强制使对象相关的 Cache 失效。 包括 Partition Cache、Schema Cache、File Cache 等。 ## 示例 @@ -68,9 +83,4 @@ REFRESH TABLE [catalog_name.][database_name.]table_name; REFRESH TABLE table1; ``` -## 关键词 - -REFRESH, CATALOG, DATABASE, TABLE - -### 最佳实践 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/SHOW-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/SHOW-CATALOG.md index 48d22f6ddeb..8c7b723fd05 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/SHOW-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/SHOW-CATALOG.md @@ -24,56 +24,70 @@ specific language governing permissions and limitations under the License. --> - - -### 描述 +## 描述 该语句用于显示已存在是数据目录(catalog) -语法: +## 语法 ```sql -SHOW CATALOGS [LIKE] +SHOW CATALOGS [LIKE <catalog_name>] ``` 说明: LIKE:可按照 CATALOG 名进行模糊查询 -返回结果说明: +## 可选参数 + +**1. `<catalog_name>`** + +需要显示 catalog 的名字 + +## 返回值 + + +| Column name | Description | +|---|---| +| CatalogId | 数据目录唯一 ID | +| CatalogName | 数据目录名称,其中 internal 是默认内置的 catalog,不可修改 | +| Type | 数据目录类型 | +| IsCurrent | 是否为当前正在使用的数据目录 | +| CreateTime | 创建时间 | +| LastUpdateTime | 最后更新时间 | +| Comment | 备注 | -* CatalogId:数据目录唯一 ID -* CatalogName:数据目录名称。其中 internal 是默认内置的 catalog,不可修改。 -* Type:数据目录类型。 -* IsCurrent: 是否为当前正在使用的数据目录。 +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:---------------------------------------------------------------------------------------------|:-----------|:---------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | 需要有上述权限中的一种就可以 | -### 示例 + +## 示例 1. 查看当前已创建的数据目录 ```sql SHOW CATALOGS; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | | 0 | internal | internal | yes | UNRECORDED | NULL | Doris internal catalog | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` - + ``` + 2. 按照目录名进行模糊搜索 ```sql SHOW CATALOGS LIKE 'hi%'; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` - -### 关键词 - -SHOW, CATALOG, CATALOGS - - + ``` \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md index 8c2e750b767..5e6ca3aa352 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md @@ -23,37 +23,47 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - - - - - - ## 描述 -该语句查看 doris 数据目录的创建语句。 +该语句查看 Doris 数据目录的创建语句。 -语法: +## 语法 ```sql -SHOW CREATE CATALOG catalog_name; +SHOW CREATE CATALOG <catalog_name>; ``` -说明: +## 必选参数 + +**1. `<catalog_name>`** -- `catalog_name`: 为 doris 中存在的数据目录的名称。 +需要查看创建语句的 catalog 的名字 + +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:---------------------------------------------------------------------------------------------|:-----------|:---------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | 需要有上述权限中的一种就可以 | ## 示例 -1. 查看 doris 中 hive 数据目录的创建语句 +1. 查看 Doris 中 oracle 数据目录的创建语句 ```sql - SHOW CREATE CATALOG hive; + SHOW CREATE CATALOG oracle; ``` - -## 关键词 - - SHOW, CREATE, CATALOG - -### 最佳实践 - + ```sql + +---------+----------------------------------------------------------------------------------------------------------------------+ + | Catalog | CreateCatalog | + +---------+----------------------------------------------------------------------------------------------------------------------+ + | oracle | + CREATE CATALOG `oracle` PROPERTIES ( + "user" = "XXX", + "type" = "jdbc", + "password" = "*XXX", + "jdbc_url" = "XXX", + "driver_url" = "XXX", + "driver_class" = "oracle.jdbc.driver.OracleDriver", + "checksum" = "XXX" + ); | + +---------+----------------------------------------------------------------------------------------------------------------------+ + ``` \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/ALTER-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/ALTER-CATALOG.md index f9a7321cb36..cebf02d5fc3 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/ALTER-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/ALTER-CATALOG.md @@ -24,68 +24,83 @@ specific language governing permissions and limitations under the License. --> +## 描述 +该语句用于设置指定数据目录的属性。 +## 语法 +1) 重命名数据目录 + ```sql + ALTER CATALOG <catalog_name> RENAME <new_catalog_name>; + ``` +2) 设置数据目录属性 -## 描述 + ```sql + ALTER CATALOG <catalog_name> SET PROPERTIES ('<key>' = '<value>' [, ... ]); + ``` -该语句用于设置指定数据目录的属性。(仅管理员使用) +3) 修改数据目录注释 -1) 重命名数据目录 + ```sql + ALTER CATALOG <catalog_name> MODIFY COMMENT "<new catalog comment>"; + ``` + +## 必选参数 + +**1. `<catalog_name>`** + +需要修改的 Catalog 名称 + +**2. `<new_catalog_name>`** + +修改后的新 Catalog 名称 + +**3. `'<key>' = '<value>'`** + +需要修改/添加的 Catalog 属性的key和value -```sql -ALTER CATALOG catalog_name RENAME new_catalog_name; -``` -注意: +**4. `<new catalog comment>`** + +修改后的 Catalog 注释 + +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:--------------|:-------------|:--------------------------| +| ALTER_PRIV | Catalog | 需要有对应catalog的ALTER_PRIV权限 | + +## 注意事项 + +1) 重命名数据目录 - `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` 的属性 +- 更新指定属性的值为指定的 value。如果 SET PROPERTIES 从句中的 key 在指定 catalog 属性中不存在,则新增此 key。 3) 修改数据目录注释 - -```sql -ALTER CATALOG catalog_name MODIFY COMMENT "new catalog comment"; -``` - -注意: - `internal` 是内置数据目录,不允许修改注释 ## 示例 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'); -``` - -4. 更改名为 hive 数据目录的注释 + ```sql + ALTER CATALOG ctlg_hive RENAME hive; + ``` -```sql -ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; -``` +2. 更新名为 hive 数据目录的属性 `hive.metastore.uris` -## 关键词 + ```sql + ALTER CATALOG hive SET PROPERTIES ('hive.metastore.uris'='thrift://172.21.0.1:9083'); + ``` -ALTER,CATALOG,RENAME,PROPERTY +3. 更改名为 hive 数据目录的注释 -## 最佳实践 + ```sql + ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; + ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/CREATE-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/CREATE-CATALOG.md index 6a71467f099..9f654921e0a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/CREATE-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/CREATE-CATALOG.md @@ -24,24 +24,43 @@ specific language governing permissions and limitations under the License. --> - - - ## 描述 该语句用于创建外部数据目录(catalog) -语法: +## 语法 ```sql -CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] - PROPERTIES ("key"="value", ...); +CREATE CATALOG [IF NOT EXISTS] <catalog_name> [ COMMENT "<comment>"] + PROPERTIES ("<key>"="<value>" [, ... ]); ``` * hms:Hive MetaStore * es:Elasticsearch * jdbc:数据库访问的标准接口 (JDBC), 当前支持 MySQL 和 PostgreSQL + +## 必选参数 + +**1. `<catalog_name>`** + +需要创建 catalog 的名字 + +**2. `"<key>"="<value>"`** + +需要创建 catalog 的参数 + +## 可选参数 + +**1. `<comment>`** + +需要创建 catalog 的注释 + +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:--------------|:-----------|:---------------------------| +| CREATE_PRIV | Catalog | 需要有对应catalog的CREATE_PRIV权限 | + ## 示例 1. 新建数据目录 hive @@ -168,10 +187,3 @@ CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] "driver_class" = "com.oceanbase.jdbc.Driver" ); ``` - -## 关键词 - -CREATE, CATALOG - -## 最佳实践 - diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/DROP-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/DROP-CATALOG.md index a30d33246b6..bf754bcb4b7 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/DROP-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/DROP-CATALOG.md @@ -24,21 +24,25 @@ specific language governing permissions and limitations under the License. --> - - - - - - ## 描述 该语句用于删除外部数据目录(catalog) -语法: +## 语法 ```sql -DROP CATALOG [IF EXISTS] catalog_name; +DROP CATALOG [IF EXISTS] <catalog_name>; ``` +## 必选参数 + +**1. `<catalog_name>`** + +需要删除 catalog 的名字 + +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:--------------|:-----------|:-------------------------| +| DROP_PRIV | Catalog | 需要有对应catalog的DROP_PRIV权限 | ## 示例 @@ -48,9 +52,3 @@ DROP CATALOG [IF EXISTS] catalog_name; DROP CATALOG hive; ``` -## 关键词 - -DROP, CATALOG - -## 最佳实践 - diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/REFRESH.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/REFRESH.md index 94bd4c75d9e..20e38612168 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/REFRESH.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/REFRESH.md @@ -24,26 +24,42 @@ specific language governing permissions and limitations under the License. --> - - - ## 描述 该语句用于刷新指定 Catalog/Database/Table 的元数据。 -语法: +## 语法 ```sql -REFRESH CATALOG catalog_name; -REFRESH DATABASE [catalog_name.]database_name; -REFRESH TABLE [catalog_name.][database_name.]table_name; +REFRESH CATALOG <catalog_name>; +REFRESH DATABASE [<catalog_name>.]<database_name>; +REFRESH TABLE [[<catalog_name>.]<database_name>.]<table_name>; ``` -刷新 Catalog 的同时,会强制使对象相关的 Cache 失效。 +## 必选参数 + +**1. `<catalog_name>`** + +需要刷新的 catalog 的名字 + +**2. `[<catalog_name>.]<database_name>`** + +需要刷新的 catalog 里面 database 的名字 + +**3. `[[<catalog_name>.]<database_name>.]<table_name>`** -包括 Partition Cache、Schema Cache、File Cache 等。 +需要刷新的 catalog 里面 table 的名字 +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:---------------------------------------------------------------------------------------------|:-----------|:---------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | 需要有上述权限中的一种就可以 | + + +## 注意事项 +刷新 Catalog 的同时,会强制使对象相关的 Cache 失效。 包括 Partition Cache、Schema Cache、File Cache 等。 + ## 示例 1. 刷新 hive catalog @@ -65,11 +81,4 @@ REFRESH TABLE [catalog_name.][database_name.]table_name; REFRESH TABLE ctl.db.table1; REFRESH TABLE db.table1; REFRESH TABLE table1; - ``` - -## 关键词 - -REFRESH, CATALOG, DATABASE, TABLE - -## 最佳实践 - + ``` \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CATALOG.md index b84b893d0c5..e8c9182feba 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CATALOG.md @@ -24,31 +24,44 @@ specific language governing permissions and limitations under the License. --> - - - - - ## 描述 该语句用于显示已存在是数据目录(catalog) -语法: +## 语法 ```sql -SHOW CATALOGS [LIKE] +SHOW CATALOGS [LIKE <catalog_name>] ``` 说明: LIKE:可按照 CATALOG 名进行模糊查询 -返回结果说明: +## 可选参数 + +**1. `<catalog_name>`** + +需要显示 catalog 的名字 + +## 返回值 + + +| Column name | Description | +|---|---| +| CatalogId | 数据目录唯一 ID | +| CatalogName | 数据目录名称,其中 internal 是默认内置的 catalog,不可修改 | +| Type | 数据目录类型 | +| IsCurrent | 是否为当前正在使用的数据目录 | +| CreateTime | 创建时间 | +| LastUpdateTime | 最后更新时间 | +| Comment | 备注 | + +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:---------------------------------------------------------------------------------------------|:-----------|:---------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | 需要有上述权限中的一种就可以 | -* CatalogId:数据目录唯一 ID -* CatalogName:数据目录名称。其中 internal 是默认内置的 catalog,不可修改。 -* Type:数据目录类型。 -* IsCurrent: 是否为当前正在使用的数据目录。 ## 示例 @@ -56,28 +69,25 @@ LIKE:可按照 CATALOG 名进行模糊查询 ```sql SHOW CATALOGS; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | | 0 | internal | internal | yes | UNRECORDED | NULL | Doris internal catalog | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` - + ``` + 2. 按照目录名进行模糊搜索 ```sql SHOW CATALOGS LIKE 'hi%'; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` - -## 关键词 - -SHOW, CATALOG, CATALOGS - -## 最佳实践 - + ``` \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md index 94a7e3926b9..c92f12802b6 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md @@ -23,34 +23,48 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - - - ## 描述 该语句查看 Doris 数据目录的创建语句。 -语法: +## 语法 ```sql -SHOW CREATE CATALOG catalog_name; +SHOW CREATE CATALOG <catalog_name>; ``` -说明: +## 必选参数 -- `catalog_name`: 为 Doris 中存在的数据目录的名称。 +**1. `<catalog_name>`** -## 示例 +需要查看创建语句的 catalog 的名字 -1. 查看 Doris 中 hive 数据目录的创建语句 +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:---------------------------------------------------------------------------------------------|:-----------|:---------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | 需要有上述权限中的一种就可以 | - ```sql - SHOW CREATE CATALOG hive; - ``` -## 关键词 - - SHOW, CREATE, CATALOG +## 示例 -## 最佳实践 +1. 查看 Doris 中 oracle 数据目录的创建语句 + ```sql + SHOW CREATE CATALOG oracle; + ``` + ```sql + +---------+----------------------------------------------------------------------------------------------------------------------+ + | Catalog | CreateCatalog | + +---------+----------------------------------------------------------------------------------------------------------------------+ + | oracle | + CREATE CATALOG `oracle` PROPERTIES ( + "user" = "XXX", + "type" = "jdbc", + "password" = "*XXX", + "jdbc_url" = "XXX", + "driver_url" = "XXX", + "driver_class" = "oracle.jdbc.driver.OracleDriver", + "checksum" = "XXX" + ); | + +---------+----------------------------------------------------------------------------------------------------------------------+ + ``` \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/ALTER-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/ALTER-CATALOG.md index ec39807a322..e1b9bffd803 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/ALTER-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/ALTER-CATALOG.md @@ -24,66 +24,83 @@ specific language governing permissions and limitations under the License. --> +## 描述 +该语句用于设置指定数据目录的属性。 +## 语法 +1) 重命名数据目录 -## 描述 + ```sql + ALTER CATALOG <catalog_name> RENAME <new_catalog_name>; + ``` -该语句用于设置指定数据目录的属性。(仅管理员使用) +2) 设置数据目录属性 -1) 重命名数据目录 + ```sql + ALTER CATALOG <catalog_name> SET PROPERTIES ('<key>' = '<value>' [, ... ]); + ``` + +3) 修改数据目录注释 + + ```sql + ALTER CATALOG <catalog_name> MODIFY COMMENT "<new catalog comment>"; + ``` + +## 必选参数 + +**1. `<catalog_name>`** + +需要修改的 Catalog 名称 + +**2. `<new_catalog_name>`** + +修改后的新 Catalog 名称 + +**3. `'<key>' = '<value>'`** -```sql -ALTER CATALOG catalog_name RENAME new_catalog_name; -``` -注意: +需要修改/添加的 Catalog 属性的key和value + +**4. `<new catalog comment>`** + +修改后的 Catalog 注释 + +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:--------------|:--------------|:--------------------------| +| ALTER_PRIV | Catalog | 需要有对应catalog的ALTER_PRIV权限 | + +## 注意事项 + +1) 重命名数据目录 - `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` 的属性 +- 更新指定属性的值为指定的 value。如果 SET PROPERTIES 从句中的 key 在指定 catalog 属性中不存在,则新增此 key。 3) 修改数据目录注释 - -```sql -ALTER CATALOG catalog_name MODIFY COMMENT "new catalog comment"; -``` - -注意: - `internal` 是内置数据目录,不允许修改注释 ## 示例 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'); -``` - -4. 更改名为 hive 数据目录的注释 + ```sql + ALTER CATALOG ctlg_hive RENAME hive; + ``` -```sql -ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; -``` +2. 更新名为 hive 数据目录的属性 `hive.metastore.uris` -## 关键词 + ```sql + ALTER CATALOG hive SET PROPERTIES ('hive.metastore.uris'='thrift://172.21.0.1:9083'); + ``` -ALTER,CATALOG,RENAME,PROPERTY +3. 更改名为 hive 数据目录的注释 -### 最佳实践 + ```sql + ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; + ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/CREATE-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/CREATE-CATALOG.md index e92035e4c6c..079f7f6f9e8 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/CREATE-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/CREATE-CATALOG.md @@ -24,25 +24,43 @@ specific language governing permissions and limitations under the License. --> - - - - ## 描述 该语句用于创建外部数据目录(catalog) -语法: +## 语法 ```sql -CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] - PROPERTIES ("key"="value", ...); +CREATE CATALOG [IF NOT EXISTS] <catalog_name> [ COMMENT "<comment>"] + PROPERTIES ("<key>"="<value>" [, ... ]); ``` * hms:Hive MetaStore * es:Elasticsearch * jdbc:数据库访问的标准接口 (JDBC), 当前支持 MySQL 和 PostgreSQL + +## 必选参数 + +**1. `<catalog_name>`** + +需要创建 catalog 的名字 + +**2. `"<key>"="<value>"`** + +需要创建 catalog 的参数 + +## 可选参数 + +**1. `<comment>`** + +需要创建 catalog 的注释 + +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:--------------|:-----------|:---------------------------| +| CREATE_PRIV | Catalog | 需要有对应catalog的CREATE_PRIV权限 | + ## 示例 1. 新建数据目录 hive @@ -168,10 +186,3 @@ CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] "driver_class" = "com.oceanbase.jdbc.Driver" ); ``` - -## 关键词 - -CREATE, CATALOG - -### 最佳实践 - diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/DROP-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/DROP-CATALOG.md index 2c82a150985..ea127b8c92f 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/DROP-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/DROP-CATALOG.md @@ -24,29 +24,31 @@ specific language governing permissions and limitations under the License. --> - - ## 描述 该语句用于删除外部数据目录(catalog) -语法: +## 语法 ```sql -DROP CATALOG [IF EXISTS] catalog_name; +DROP CATALOG [IF EXISTS] <catalog_name>; ``` -## 示例 +## 必选参数 -1. 删除数据目录 hive +**1. `<catalog_name>`** - ```sql - DROP CATALOG hive; - ``` +需要删除 catalog 的名字 -## 关键词 +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:--------------|:-----------|:-------------------------| +| DROP_PRIV | Catalog | 需要有对应catalog的DROP_PRIV权限 | -DROP, CATALOG +## 示例 -### 最佳实践 +1. 删除数据目录 hive + ```sql + DROP CATALOG hive; + ``` \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/REFRESH.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/REFRESH.md index 7ed3adcff63..ba31f5a4d22 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/REFRESH.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/REFRESH.md @@ -24,26 +24,41 @@ specific language governing permissions and limitations under the License. --> +## 描述 +该语句用于刷新指定 Catalog/Database/Table 的元数据。 +## 语法 +```sql +REFRESH CATALOG <catalog_name>; +REFRESH DATABASE [<catalog_name>.]<database_name>; +REFRESH TABLE [[<catalog_name>.]<database_name>.]<table_name>; +``` +## 必选参数 -## 描述 +**1. `<catalog_name>`** -该语句用于刷新指定 Catalog/Database/Table 的元数据。 +需要刷新的 catalog 的名字 -语法: +**2. `[<catalog_name>.]<database_name>`** -```sql -REFRESH CATALOG catalog_name; -REFRESH DATABASE [catalog_name.]database_name; -REFRESH TABLE [catalog_name.][database_name.]table_name; -``` +需要刷新的 catalog 里面 database 的名字 -刷新 Catalog 的同时,会强制使对象相关的 Cache 失效。 +**3. `[[<catalog_name>.]<database_name>.]<table_name>`** -包括 Partition Cache、Schema Cache、File Cache 等。 +需要刷新的 catalog 里面 table 的名字 + + +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:---------------------------------------------------------------------------------------------|:-----------|:---------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | 需要有上述权限中的一种就可以 | + + +## 注意事项 +刷新 Catalog 的同时,会强制使对象相关的 Cache 失效。 包括 Partition Cache、Schema Cache、File Cache 等。 ## 示例 @@ -67,10 +82,3 @@ REFRESH TABLE [catalog_name.][database_name.]table_name; REFRESH TABLE db.table1; REFRESH TABLE table1; ``` - -## 关键词 - -REFRESH, CATALOG, DATABASE, TABLE - -### 最佳实践 - diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CATALOG.md index 48d22f6ddeb..0e90a4278c3 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CATALOG.md @@ -24,56 +24,73 @@ specific language governing permissions and limitations under the License. --> - - -### 描述 +## 描述 该语句用于显示已存在是数据目录(catalog) -语法: +## 语法 ```sql -SHOW CATALOGS [LIKE] +SHOW CATALOGS [LIKE <catalog_name>] ``` 说明: LIKE:可按照 CATALOG 名进行模糊查询 -返回结果说明: +## 可选参数 + +**1. `<catalog_name>`** + +需要显示 catalog 的名字 + +## 返回值 + -* CatalogId:数据目录唯一 ID -* CatalogName:数据目录名称。其中 internal 是默认内置的 catalog,不可修改。 -* Type:数据目录类型。 -* IsCurrent: 是否为当前正在使用的数据目录。 +| Column name | Description | +|---|---| +| CatalogId | 数据目录唯一 ID | +| CatalogName | 数据目录名称,其中 internal 是默认内置的 catalog,不可修改 | +| Type | 数据目录类型 | +| IsCurrent | 是否为当前正在使用的数据目录 | +| CreateTime | 创建时间 | +| LastUpdateTime | 最后更新时间 | +| Comment | 备注 | -### 示例 +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:---------------------------------------------------------------------------------------------|:-----------|:---------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | 需要有上述权限中的一种就可以 | + + + +## 示例 1. 查看当前已创建的数据目录 ```sql SHOW CATALOGS; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | | 0 | internal | internal | yes | UNRECORDED | NULL | Doris internal catalog | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` + ``` 2. 按照目录名进行模糊搜索 ```sql SHOW CATALOGS LIKE 'hi%'; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` - -### 关键词 - -SHOW, CATALOG, CATALOGS + ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md index 8c2e750b767..84baefb9212 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md @@ -23,37 +23,49 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - - - - - - ## 描述 -该语句查看 doris 数据目录的创建语句。 +该语句查看 Doris 数据目录的创建语句。 -语法: +## 语法 ```sql -SHOW CREATE CATALOG catalog_name; +SHOW CREATE CATALOG <catalog_name>; ``` -说明: +## 必选参数 -- `catalog_name`: 为 doris 中存在的数据目录的名称。 +**1. `<catalog_name>`** -## 示例 +需要查看创建语句的 catalog 的名字 -1. 查看 doris 中 hive 数据目录的创建语句 - ```sql - SHOW CREATE CATALOG hive; - ``` +## 权限控制 +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +|:---------------------------------------------------------------------------------------------|:-----------|:---------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | 需要有上述权限中的一种就可以 | -## 关键词 - SHOW, CREATE, CATALOG +## 示例 -### 最佳实践 +1. 查看 Doris 中 oracle 数据目录的创建语句 + ```sql + SHOW CREATE CATALOG oracle; + ``` + ```sql + +---------+----------------------------------------------------------------------------------------------------------------------+ + | Catalog | CreateCatalog | + +---------+----------------------------------------------------------------------------------------------------------------------+ + | oracle | + CREATE CATALOG `oracle` PROPERTIES ( + "user" = "XXX", + "type" = "jdbc", + "password" = "*XXX", + "jdbc_url" = "XXX", + "driver_url" = "XXX", + "driver_class" = "oracle.jdbc.driver.OracleDriver", + "checksum" = "XXX" + ); | + +---------+----------------------------------------------------------------------------------------------------------------------+ + ``` \ No newline at end of file diff --git a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/ALTER-CATALOG.md b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/ALTER-CATALOG.md index 1dcc238bcf7..c5448a939f5 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/ALTER-CATALOG.md +++ b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/ALTER-CATALOG.md @@ -23,70 +23,86 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> +## Description +This statement is used to set properties of the specified catalog. +## Syntax +1) Rename the catalog + ```sql + ALTER CATALOG <catalog_name> RENAME <new_catalog_name>; + ``` -## Description +2) Modify / Add properties for the catalog -This statement is used to set properties of the specified catalog. (administrator only) + ```sql + ALTER CATALOG <catalog_name> SET PROPERTIES ('<key>' = '<value>' [, ... ]); + ``` -1) Rename the catalog +3) Modify comment for the catalog + + ```sql + ALTER CATALOG <catalog_name> MODIFY COMMENT "<new catalog comment>"; + ``` + +## Required Parameters + +**1. `<catalog_name>`** + +The name of the catalog that should be modified + +**2. `<new_catalog_name>`** + +New catalog name after modification + +**3. `'<key>' = '<value>'`** -```sql -ALTER CATALOG catalog_name RENAME new_catalog_name; -``` +The key and value of the catalog properties that need to be modified / added -illustrate: +**4. `<new catalog comment>`** + +Modified catalog comment + + +## Access Control Requirements +| Privilege | Object | Notes | +|:-----------|:--------|:------------------------------------------| +| ALTER_PRIV | Catalog | The ALTER_PRIV of the catalog is required | +## Usage Notes + +1) Rename the catalog - 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']); -``` +2) Modify / Add properties for the catalog -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. +- Update values of specified keys. If a key does not exist in the catalog properties, it will be added. 3) Modify comment for the catalog -```sql -ALTER CATALOG catalog_name MODIFY COMMENT "new catalog comment"; -``` - -illustrate: - The builtin catalog `internal` cannot be modified -## Examples +## 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'); -``` - -4. modify comment of catalog hive - -```sql -ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; -``` + ```sql + ALTER CATALOG ctlg_hive RENAME hive; + ``` -## Keywords +2. modify property `hive.metastore.uris` of catalog hive -ALTER,CATALOG,RENAME,PROPERTY + ```sql + ALTER CATALOG hive SET PROPERTIES ('hive.metastore.uris'='thrift://172.21.0.1:9083'); + ``` -## Best Practice +3. modify comment of catalog hive + ```sql + ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; + ``` diff --git a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/CREATE-CATALOG.md b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/CREATE-CATALOG.md index 6c9214c7f2e..d96a7f66585 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/CREATE-CATALOG.md +++ b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/CREATE-CATALOG.md @@ -24,19 +24,35 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement is used to create an external catalog -Syntax: +## Syntax ```sql -CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] - PROPERTIES ("key"="value", ...); +CREATE CATALOG [IF NOT EXISTS] <catalog_name> [ COMMENT "<comment>"] + PROPERTIES ("<key>"="<value>" [, ... ]); ``` +## Required Parameters + +**1. `<catalog_name>`** +The name of the catalog to be created. + +**2. `"<key>"="<value>"`** +The parameters for creating the catalog. + +## Optional Parameters + +**1. `<comment>`** +The comment for the catalog to be created. + +## Access Control Requirements +| Privilege | Object | Notes | +|:------------|:--------|:----------------------------------------------------------------------| +| CREATE_PRIV | Catalog | The CREATE_PRIV permission for the corresponding catalog is required. | + ## Examples 1. Create catalog hive @@ -163,9 +179,4 @@ CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] ); ``` -## Keywords - -CREATE, CATALOG - -## Best Practice diff --git a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/DROP-CATALOG.md b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/DROP-CATALOG.md index b0a7649992f..c7b9648c7f3 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/DROP-CATALOG.md +++ b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/DROP-CATALOG.md @@ -25,29 +25,31 @@ under the License. --> - - ## Description This statement is used to delete the external catalog. -Syntax: +## Syntax ```sql -DROP CATALOG [I EXISTS] catalog_name; +DROP CATALOG [IF EXISTS] <catalog_name>; ``` -## Examples +## Required Parameters -1. Drop catalog hive +**1. `<catalog_name>`** +The name of the catalog to be dropped. - ```sql - DROP CATALOG hive; - ``` +## Access Control Requirements +| Privilege | Object | Notes | +|:----------|:--------|:--------------------------------------------------------------------| +| DROP_PRIV | Catalog | The DROP_PRIV permission for the corresponding catalog is required. | -## Keywords -DROP, CATALOG +## Example -## Best Practice +1. Drop catalog hive + ```sql + DROP CATALOG hive; + ``` \ No newline at end of file diff --git a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/REFRESH.md b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/REFRESH.md index 986577507c1..1b773cba6ab 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/REFRESH.md +++ b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/REFRESH.md @@ -24,25 +24,42 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement refreshes the metadata of the specified Catalog/Database/Table. -syntax: +## Syntax ```sql -REFRESH CATALOG catalog_name; -REFRESH DATABASE [catalog_name.]database_name; -REFRESH TABLE [catalog_name.][database_name.]table_name; +REFRESH CATALOG <catalog_name>; +REFRESH DATABASE [<catalog_name>.]<database_name>; +REFRESH TABLE [[<catalog_name>.]<database_name>.]<table_name>; ``` -When the Catalog is refreshed, the object-related Cache is forced to be invalidated. +## Required Parameters + +**1. `<catalog_name>`** + +The name of the catalog that needs to be refreshed. + +**2. `[<catalog_name>.]<database_name>`** + +The name of the database within the catalog that needs to be refreshed. + +**3. `[[<catalog_name>.]<database_name>.]<table_name>`** + +The name of the table within the catalog that needs to be refreshed. -Including Partition Cache, Schema Cache, File Cache, etc. +## Access Control Requirements +| Privilege | Object | Notes | +|:---------------------------------------------------------------------------------------------|:--------|:------------------------------------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | One of the above permissions is required. | -## Examples + +## Usage Notes +When the Catalog is refreshed, the object-related Cache is forced to be invalidated. Including Partition Cache, Schema Cache, File Cache, etc. + +## Example 1. Refresh hive catalog @@ -63,11 +80,4 @@ Including Partition Cache, Schema Cache, File Cache, etc. REFRESH TABLE ctl.db.table1; REFRESH TABLE db.table1; REFRESH TABLE table1; - ``` - -## Keywords - -REFRESH, CATALOG, DATABASE, TABLE - -## Best Practice - + ``` \ No newline at end of file diff --git a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CATALOG.md b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CATALOG.md index 67f2580f513..c29b063415b 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CATALOG.md +++ b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CATALOG.md @@ -24,29 +24,43 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement is used for view created catalogs -Syntax: +## Syntax ```sql -SHOW CATALOGS [LIKE] +SHOW CATALOGS [LIKE <catalog_name>] ``` illustrate: 1. LIKE: Fuzzy query can be performed according to the catalog name +## Optional Parameters + +**1. `<catalog_name>`** + +The name of the catalog to be displayed. + +## Return Value -Return result: +| Column Name | Description | +|---|---| +| CatalogId | Unique ID of the data catalog | +| CatalogName | Name of the data catalog. The default built-in catalog is named "internal" and cannot be modified. | +| Type | Type of the data catalog | +| IsCurrent | Indicates whether it is the currently active data catalog | +| CreateTime | Creation time | +| LastUpdateTime | Last updated time | +| Comment | comments about the catalog | + +## Access Control Requirements +| Privilege | Object | Notes | +|:---------------------------------------------------------------------------------------------|:--------|:------------------------------------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | One of the above permissions is required. | -* CatalogId: Unique ID of the catalog -* CatalogName: Catalog name. where "internal" is the default built-in catalog, which cannot be modified. -* Type: Catalog type. -* IsCurrent: Show yes on the line of current using catalog. ## Examples @@ -54,28 +68,26 @@ Return result: ```sql SHOW CATALOGS; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | | 0 | internal | internal | yes | UNRECORDED | NULL | Doris internal catalog | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` + ``` 2. Fuzzy query by catalog name ```sql SHOW CATALOGS LIKE 'hi%'; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` - -## Keywords - -SHOW, CATALOG, CATALOGS - -## Best Practice + ``` diff --git a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md index a1af8c96952..1bfe479417b 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md +++ b/versioned_docs/version-2.1/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md @@ -30,26 +30,45 @@ under the License. This statement shows the creating statement of a doris catalog. -grammar: +## Syntax ```sql -SHOW CREATE CATALOG catalog_name; +SHOW CREATE CATALOG <catalog_name>; ``` -illustrate: -- `catalog_name`: The name of the catalog which exist in doris. +## Required Parameters -## Examples +**1. `<catalog_name>`** -1. View the creating statement of the hive catalog in doris +The name of the catalog whose creation statement needs to be viewed. - ```sql - SHOW CREATE CATALOG hive; - ``` +## Access Control Requirements +| Privilege | Object | Notes | +|:---------------------------------------------------------------------------------------------|:--------|:------------------------------------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | One of the above permissions is required. | -## Keywords - SHOW, CREATE, CATALOG +## Examples + +1. View the creating statement of the hive oracle in doris -## Best Practice + ```sql + SHOW CREATE CATALOG oracle; + ``` + ```sql + +---------+----------------------------------------------------------------------------------------------------------------------+ + | Catalog | CreateCatalog | + +---------+----------------------------------------------------------------------------------------------------------------------+ + | oracle | + CREATE CATALOG `oracle` PROPERTIES ( + "user" = "XXX", + "type" = "jdbc", + "password" = "*XXX", + "jdbc_url" = "XXX", + "driver_url" = "XXX", + "driver_class" = "oracle.jdbc.driver.OracleDriver", + "checksum" = "XXX" + ); | + +---------+----------------------------------------------------------------------------------------------------------------------+ + ``` diff --git a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/ALTER-CATALOG.md b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/ALTER-CATALOG.md index e6435151dba..65f65805126 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/ALTER-CATALOG.md +++ b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/ALTER-CATALOG.md @@ -25,72 +25,87 @@ specific language governing permissions and limitations under the License. --> +## Description +This statement is used to set properties of the specified catalog. +## Syntax +1) Rename the catalog -## Description + ```sql + ALTER CATALOG <catalog_name> RENAME <new_catalog_name>; + ``` -This statement is used to set properties of the specified catalog. (administrator only) +2) Modify / Add properties for the catalog -1) Rename the catalog + ```sql + ALTER CATALOG <catalog_name> SET PROPERTIES ('<key>' = '<value>' [, ... ]); + ``` -```sql -ALTER CATALOG catalog_name RENAME new_catalog_name; -``` +3) Modify comment for the catalog -illustrate: + ```sql + ALTER CATALOG <catalog_name> MODIFY COMMENT "<new catalog comment>"; + ``` + +## Required Parameters -- 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 +**1. `<catalog_name>`** -2) Modify / add properties for the catalog +The name of the catalog that should be modified -```sql -ALTER CATALOG catalog_name SET PROPERTIES ('key1' = 'value1' [, 'key' = 'value2']); -``` +**2. `<new_catalog_name>`** -Update values of specified keys. If a key does not exist in the catalog properties, it will be added. +New catalog name after modification -illustrate: +**3. `'<key>' = '<value>'`** -- property `type` cannot be modified. -- properties of builtin catalog `internal` cannot be modified. +The key and value of the catalog properties that need to be modified / added -3) Modify comment for the catalog +**4. `<new catalog comment>`** -```sql -ALTER CATALOG catalog_name MODIFY COMMENT "new catalog comment"; -``` +Modified catalog comment -illustrate: -- The builtin catalog `internal` cannot be modified +## Access Control Requirements +| Privilege | Object | Notes | +|:-----------|:----------|:------------------------------------------| +| ALTER_PRIV | Catalog | The ALTER_PRIV of the catalog is required | -## Example +## Usage Notes -1. rename catalog ctlg_hive to hive +1) Rename the catalog +- 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 - ```sql - ALTER CATALOG ctlg_hive RENAME hive; - ``` +2) Modify / Add properties for the catalog -3. modify property `hive.metastore.uris` of catalog hive +- property `type` cannot be modified. +- properties of builtin catalog `internal` cannot be modified. +- Update values of specified keys. If a key does not exist in the catalog properties, it will be added. - ```sql - ALTER CATALOG hive SET PROPERTIES ('hive.metastore.uris'='thrift://172.21.0.1:9083'); - ``` +3) Modify comment for the catalog + +- The builtin catalog `internal` cannot be modified -4. modify comment of catalog hive +## Example + +1. rename catalog ctlg_hive to hive - ```sql - ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; - ``` + ```sql + ALTER CATALOG ctlg_hive RENAME hive; + ``` -## Keywords +2. modify property `hive.metastore.uris` of catalog hive -ALTER,CATALOG,RENAME,PROPERTY + ```sql + ALTER CATALOG hive SET PROPERTIES ('hive.metastore.uris'='thrift://172.21.0.1:9083'); + ``` -## Best Practice +3. modify comment of catalog hive + ```sql + ALTER CATALOG hive MODIFY COMMENT "new catalog comment"; + ``` diff --git a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/CREATE-CATALOG.md b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/CREATE-CATALOG.md index 7167606ecb7..49d57db8689 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/CREATE-CATALOG.md +++ b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/CREATE-CATALOG.md @@ -24,18 +24,35 @@ specific language governing permissions and limitations under the License. --> - ## Description This statement is used to create an external catalog -Syntax: +## Syntax ```sql -CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] - PROPERTIES ("key"="value", ...); +CREATE CATALOG [IF NOT EXISTS] <catalog_name> [ COMMENT "<comment>"] + PROPERTIES ("<key>"="<value>" [, ... ]); ``` +## Required Parameters + +**1. `<catalog_name>`** +The name of the catalog to be created. + +**2. `"<key>"="<value>"`** +The parameters for creating the catalog. + +## Optional Parameters + +**1. `<comment>`** +The comment for the catalog to be created. + +## Access Control Requirements +| Privilege | Object | Notes | +|:------------|:--------|:----------------------------------------------------------------------| +| CREATE_PRIV | Catalog | The CREATE_PRIV permission for the corresponding catalog is required. | + ## Example 1. Create catalog hive @@ -162,9 +179,4 @@ CREATE CATALOG [IF NOT EXISTS] catalog_name [comment] ); ``` -## Keywords - -CREATE, CATALOG - -## Best Practice diff --git a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/DROP-CATALOG.md b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/DROP-CATALOG.md index b9145354b88..c7b9648c7f3 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/DROP-CATALOG.md +++ b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/DROP-CATALOG.md @@ -25,28 +25,31 @@ under the License. --> - ## Description This statement is used to delete the external catalog. -Syntax: +## Syntax ```sql -DROP CATALOG [I EXISTS] catalog_name; +DROP CATALOG [IF EXISTS] <catalog_name>; ``` -## Example +## Required Parameters -1. Drop catalog hive +**1. `<catalog_name>`** +The name of the catalog to be dropped. - ```sql - DROP CATALOG hive; - ``` +## Access Control Requirements +| Privilege | Object | Notes | +|:----------|:--------|:--------------------------------------------------------------------| +| DROP_PRIV | Catalog | The DROP_PRIV permission for the corresponding catalog is required. | -## Keywords -DROP, CATALOG +## Example -## Best Practice +1. Drop catalog hive + ```sql + DROP CATALOG hive; + ``` \ No newline at end of file diff --git a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/REFRESH.md b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/REFRESH.md index 79e3e9d26c0..2cd549d7400 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/REFRESH.md +++ b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/REFRESH.md @@ -24,23 +24,40 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement refreshes the metadata of the specified Catalog/Database/Table. -syntax: +## Syntax ```sql -REFRESH CATALOG catalog_name; -REFRESH DATABASE [catalog_name.]database_name; -REFRESH TABLE [catalog_name.][database_name.]table_name; +REFRESH CATALOG <catalog_name>; +REFRESH DATABASE [<catalog_name>.]<database_name>; +REFRESH TABLE [[<catalog_name>.]<database_name>.]<table_name>; ``` -When the Catalog is refreshed, the object-related Cache is forced to be invalidated. +## Required Parameters + +**1. `<catalog_name>`** + +The name of the catalog that needs to be refreshed. + +**2. `[<catalog_name>.]<database_name>`** + +The name of the database within the catalog that needs to be refreshed. + +**3. `[[<catalog_name>.]<database_name>.]<table_name>`** -Including Partition Cache, Schema Cache, File Cache, etc. +The name of the table within the catalog that needs to be refreshed. + +## Access Control Requirements +| Privilege | Object | Notes | +|:---------------------------------------------------------------------------------------------|:--------|:------------------------------------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | One of the above permissions is required. | + + +## Usage Notes +When the Catalog is refreshed, the object-related Cache is forced to be invalidated. Including Partition Cache, Schema Cache, File Cache, etc. ## Example @@ -64,10 +81,3 @@ Including Partition Cache, Schema Cache, File Cache, etc. REFRESH TABLE db.table1; REFRESH TABLE table1; ``` - -## Keywords - -REFRESH, CATALOG, DATABASE, TABLE - -## Best Practice - diff --git a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CATALOG.md b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CATALOG.md index b252c074ef3..5e8f754b825 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CATALOG.md +++ b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CATALOG.md @@ -24,16 +24,14 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement is used for view created catalogs -Syntax: +## Syntax ```sql -SHOW CATALOGS [LIKE] +SHOW CATALOGS [LIKE <catalog_name>] ``` illustrate: @@ -41,41 +39,55 @@ illustrate: 1. LIKE: Fuzzy query can be performed according to the catalog name -Return result: +## Optional Parameters + +**1. `<catalog_name>`** + +The name of the catalog to be displayed. + +## Return Value + +| Column Name | Description | +|---|---| +| CatalogId | Unique ID of the data catalog | +| CatalogName | Name of the data catalog. The default built-in catalog is named "internal" and cannot be modified. | +| Type | Type of the data catalog | +| IsCurrent | Indicates whether it is the currently active data catalog | +| CreateTime | Creation time | +| LastUpdateTime | Last updated time | +| Comment | comments about the catalog | -* CatalogId: Unique ID of the catalog -* CatalogName: Catalog name. where "internal" is the default built-in catalog, which cannot be modified. -* Type: Catalog type. -* IsCurrent: Show yes on the line of current using catalog. +## Access Control Requirements +| Privilege | Object | Notes | +|:---------------------------------------------------------------------------------------------|:--------|:------------------------------------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | One of the above permissions is required. | -## Example + +## Examples 1. View the data catalogs that have been created currently ```sql SHOW CATALOGS; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | | 0 | internal | internal | yes | UNRECORDED | NULL | Doris internal catalog | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` + ``` 2. Fuzzy query by catalog name ```sql SHOW CATALOGS LIKE 'hi%'; + ``` + ```sql +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | CatalogId | CatalogName | Type | IsCurrent | CreateTime | LastUpdateTime | Comment | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ | 130100 | hive | hms | | 2023-12-25 16:11:41.687 | 2023-12-25 20:43:18 | NULL | +-----------+-------------+----------+-----------+-------------------------+---------------------+------------------------+ - ``` - -## Keywords - -SHOW, CATALOG, CATALOGS - -## Best Practice - + ``` diff --git a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md index 8da2b8f6e74..6ade3128b75 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md +++ b/versioned_docs/version-3.0/sql-manual/sql-statements/catalog/SHOW-CREATE-CATALOG.md @@ -32,27 +32,45 @@ under the License. This statement shows the creating statement of a doris catalog. -grammar: +## Syntax ```sql -SHOW CREATE CATALOG catalog_name; +SHOW CREATE CATALOG <catalog_name>; ``` -illustrate: +## Required Parameters -- `catalog_name`: The name of the catalog which exist in doris. +**1. `<catalog_name>`** -## Example +The name of the catalog whose creation statement needs to be viewed. -1. View the creating statement of the hive catalog in doris +## Access Control Requirements +| Privilege | Object | Notes | +|:---------------------------------------------------------------------------------------------|:--------|:------------------------------------------| +| ADMIN_PRIV / SELECT_PRIV / LOAD_PRIV / ALTER_PRIV / CREATE_PRIV / SHOW_VIEW_PRIV / DROP_PRIV | Catalog | One of the above permissions is required. | - ```sql - SHOW CREATE CATALOG hive; - ``` -## Keywords +## Example -SHOW, CREATE, CATALOG +1. View the creating statement of the oracle catalog in doris -## Best Practice + ```sql + SHOW CREATE CATALOG oracle; + ``` + ```sql + +---------+----------------------------------------------------------------------------------------------------------------------+ + | Catalog | CreateCatalog | + +---------+----------------------------------------------------------------------------------------------------------------------+ + | oracle | + CREATE CATALOG `oracle` PROPERTIES ( + "user" = "XXX", + "type" = "jdbc", + "password" = "*XXX", + "jdbc_url" = "XXX", + "driver_url" = "XXX", + "driver_class" = "oracle.jdbc.driver.OracleDriver", + "checksum" = "XXX" + ); | + +---------+----------------------------------------------------------------------------------------------------------------------+ + ``` --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org