forked from turbot/steampipe-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschemas_and_tables.sp
101 lines (88 loc) · 1.96 KB
/
schemas_and_tables.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
dashboard "schemas_and_tables" {
tags = {
service = "v18 examples"
}
graph {
title = "schemas & tables"
node {
category = category.catalog
sql = <<EOQ
select
distinct on (catalog_name)
concat('catalog:',catalog_name) as id,
catalog_name as title
from
information_schema.schemata
where
schema_name = 'net'
EOQ
}
node {
category = category.schema
sql = <<EOQ
select
concat('schema:',schema_name) as id,
schema_name as title,
json_build_object(
'catalog', catalog_name,
'schema', schema_name,
'owner', schema_owner
) as properties
from
information_schema.schemata
where
schema_name = 'net'
EOQ
}
node {
category = category.table
sql = <<EOQ
select
concat('table:',table_name) as id,
table_name as title,
json_build_object(
'catalog', table_catalog,
'schema', table_schema,
'type', table_type
) as properties
from
information_schema.tables
where
table_schema = 'net'
EOQ
}
edge {
sql = <<EOQ
select
concat('catalog:',catalog_name) as from_id,
concat('schema:',schema_name) as to_id
from
information_schema.schemata
EOQ
}
edge {
sql = <<EOQ
select
concat('schema:',table_schema) as from_id,
concat('table:',table_name) as to_id
from
information_schema.tables
EOQ
}
}
}
category "catalog" {
title = "catalog"
icon = "book"
color = "orange"
}
category "schema" {
title = "schema"
icon = "schema"
color = "blue"
}
category "table" {
title = "table"
icon = "table"
color = "green"
}