Skip to content

Commit ab8f58b

Browse files
authored
Create 6-monitor-with-user-annotations-usage.sql
1 parent a69fc87 commit ab8f58b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
REM Script for 23c: 6-monitor-with-user-annotations-usage.sql
2+
REM Use USER_ANNOTATIONS_USAGE to track the list of annotations and their usage across your schema objects
3+
4+
-- Obtain column-level annotations
5+
6+
set lines 200
7+
set pages 200
8+
col object_name format a25
9+
col object_type format a15
10+
col annotation_name format a15
11+
col annotation_value format a25
12+
col column_name format a20
13+
14+
select object_name, object_type, column_name, annotation_name, annotation_value
15+
from user_annotations_usage
16+
where column_name is not null order by 2,1;
17+
18+
-- Display annotations as a single JSON collection per column
19+
select object_type, object_name, column_Name, JSON_ARRAYAGG(JSON_OBJECT(Annotation_Name, Annotation_Value)) in_jsonformat
20+
from user_annotations_usage
21+
where column_name is not null group by object_type, object_name, column_name;

0 commit comments

Comments
 (0)