SHOW-POLICY

Name

SHOW ROW POLICY

Description

查看当前 DB 下的行安全策略

语法:

1. SHOW ROW POLICY [FOR user| ROLE role]

Example

  1. 查看所有安全策略。

1. mysql> SHOW ROW POLICY; 2. +-------------------+----------------------+-----------+------+-------------+-------------------+------+-------------------------------------------------------------------------------------------------------------------------------------------+ 3. | PolicyName | DbName | TableName | Type | FilterType | WherePredicate | User | OriginStmt | 4. +-------------------+----------------------+-----------+------+-------------+-------------------+------+-------------------------------------------------------------------------------------------------------------------------------------------+ 5. | test_row_policy_1 | default_cluster:test | table1 | ROW | RESTRICTIVE | `id` IN (1, 2) | root | /* ApplicationName=DataGrip 2021.3.4 */ CREATE ROW POLICY test_row_policy_1 ON test.table1 AS RESTRICTIVE TO root USING (id in (1, 2)); 6. | 7. | test_row_policy_2 | default_cluster:test | table1 | ROW | RESTRICTIVE | `col1` = 'col1_1' | root | /* ApplicationName=DataGrip 2021.3.4 */ CREATE ROW POLICY test_row_policy_2 ON test.table1 AS RESTRICTIVE TO root USING (col1='col1_1'); 8. | 9. +-------------------+----------------------+-----------+------+-------------+-------------------+------+-------------------------------------------------------------------------------------------------------------------------------------------+ 10. 2 rows in set (0.00 sec) 2. 指定用户名查询

1. mysql> SHOW ROW POLICY FOR test; 2. +-------------------+----------------------+-----------+------+------------+-------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------------+ 3. | PolicyName | DbName | TableName | Type | FilterType | WherePredicate | User | OriginStmt | 4. +-------------------+----------------------+-----------+------+------------+-------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------------+ 5. | test_row_policy_3 | default_cluster:test | table1 | ROW | PERMISSIVE | `col1` = 'col1_2' | default_cluster:test | /* ApplicationName=DataGrip 2021.3.4 */ CREATE ROW POLICY test_row_policy_3 ON test.table1 AS PERMISSIVE TO test USING (col1='col1_2'); 6. | 7. +-------------------+----------------------+-----------+------+------------+-------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------------+ 8. 1 row in set (0.01 sec) 3. 指定角色名查询

1. mysql> SHOW ROW POLICY for role role1; 2. +------------+--------+-----------+------+-------------+----------------+------+-------+----------------------------------------------------------------------------------+ 3. | PolicyName | DbName | TableName | Type | FilterType | WherePredicate | User | Role | OriginStmt | 4. +------------+--------+-----------+------+-------------+----------------+------+-------+----------------------------------------------------------------------------------+ 5. | zdtest1 | zd | user | ROW | RESTRICTIVE | `user_id` = 1 | NULL | role1 | create row policy zdtest1 on user as restrictive to role role1 using (user_id=1) | 6. +------------+--------+-----------+------+-------------+----------------+------+-------+----------------------------------------------------------------------------------+ 7. 1 row in set (0.01 sec) 4. 展示数据迁移策略

1. mysql> SHOW STORAGE POLICY; 2. +---------------------+---------+-----------------------+---------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 3. | PolicyName | Type | StorageResource | CooldownDatetime | CooldownTtl | properties | 4. +---------------------+---------+-----------------------+---------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 5. | showPolicy_1_policy | STORAGE | showPolicy_1_resource | 2022-06-08 00:00:00 | -1 | { 6. "type": "s3", 7. "s3.endpoint": "bj.s3.comaaaa", 8. "s3.region": "bj", 9. "s3.access_key": "bbba", 10. "s3.secret_key": "******", 11. "s3.root.path": "path/to/rootaaaa", 12. "s3.bucket": "test-bucket", 13. "s3.connection.request.timeout": "3000" 14. "3.connection.maximum": "50", 15. "s3.connection.timeout": "1000", 16. } | 17. +---------------------+---------+-----------------------+---------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 18. 1 row in set (0.00 sec)

Keywords

1. SHOW, POLICY

Best Practice