-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsnowflake_logs.html
157 lines (143 loc) · 4.93 KB
/
snowflake_logs.html
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<html>
<head>
<title>Snowflake Query Logs</title>
<style>
body {
font-family: Arial, sans-serif;
color: #24292e;
background-color: #f6f8fa;
padding: 10px;
}
.log {
border: 1px solid #e1e4e8;
border-radius: 6px;
padding: 16px;
background-color: #ffffff;
margin-bottom: 16px;
font-size: 14px;
line-height: 1.5;
}
.log-title {
font-weight: 600;
margin-bottom: 8px;
}
.log-content {
white-space: pre-wrap;
font-family: monospace;
}
.log-summary {
margin-top: 8px;
font-weight: 600;
}
</style>
</head>
<body>
<div class="log">
<div class="log-title">Query #1</div>
<div class="log-content">
select * from dbt.by_day where library = 're_cloud' order by date desc limit 1000;
</div>
<div class="log-summary">
Execution Time: 0.5s | Cost: 10 Snowflake credits
</div>
</div>
<div class="log">
<div class="log-title">Query #2</div>
<div class="log-content">
select * from dbt.by_day where library = 're_cloud' order by date desc limit 100;
</div>
<div class="log-summary">
Execution Time: 1.2s | Cost: 12 Snowflake credits
</div>
</div>
<div class="log">
<div class="log-title">Query #3</div>
<div class="log-content">
with tables as (
select
table_catalog as "table_database",
table_schema as "table_schema",
table_name as "table_name",
table_type as "table_type",
comment as "table_comment",
-- note: this is the _role_ that owns the table
table_owner as "table_owner",
'Clustering Key' as "stats:clustering_key:label",
clustering_key as "stats:clustering_key:value",
'The key used to cluster this table' as "stats:clustering_key:description",
(clustering_key is not null) as "stats:clustering_key:include",
'Row Count' as "stats:row_count:label",
row_count as "stats:row_count:value",
'An approximate count of rows in this table' as "stats:row_count:description",
(row_count is not null) as "stats:row_count:include",
'Approximate Size' as "stats:bytes:label",
bytes as "stats:bytes:value",
'Approximate size of the table as reported by Snowflake' as "stats:bytes:description",
(bytes is not null) as "stats:bytes:include",
'Last Modified' as "stats:last_modified:label",
to_varchar(convert_timezone('UTC', last_altered), 'yyyy-mm-dd HH24:MI'||'UTC') as "stats:last_modified:value",
'The timestamp for last update/change' as "stats:last_modified:description",
(last_altered is not null and table_type='BASE TABLE') as "stats:last_modified:include"
from SEGMENT_EVENTS.INFORMATION_SCHEMA.tables
),
columns as (
select
table_catalog as "table_database",
table_schema as "table_schema",
table_name as "table_name",
column_name as "column_name",
ordinal_position as "column_index",
data_type as "column_type",
comment as "column_comment"
from SEGMENT_EVENTS.INFORMATION_SCHEMA.columns
)
select *
from tables
join columns using ("table_database", "table_schema", "table_name")
where (upper("table_schema") = upper('dbt') or upper("table_schema") = upper('dbt_re_internal') or upper("table_schema") = upper('dbt_re') or upper("table_schema") = upper('re_data_python_library'))
order by "column_index"
</div>
<div class="log-summary">
Execution Time: 0.5s | Cost: 10 Snowflake credits
</div>
</div>
<div class="log">
<div class="log-title">Query #4</div>
<div class="log-content">
UPDATE users SET active = false WHERE last_login < '2023-01-01';
</div>
<div class="log-summary">
Execution Time: 1.2s | Cost: 12 Snowflake credits
</div>
</div>
<div class="log">
<div class="log-title">Query #3</div>
<div class="log-content">
SELECT * FROM users WHERE last_login > '2023-01-01';
</div>
<div class="log-summary">
Execution Time: 0.5s | Cost: 10 Snowflake credits
</div>
</div>
<div class="log">
<div class="log-title">Query #4</div>
<div class="log-content">
UPDATE users SET active = false WHERE last_login < '2023-01-01';
</div>
<div class="log-summary">
Execution Time: 1.2s | Cost: 12 Snowflake credits
</div>
</div>
<div class="log">
<div class="log-title">Query #5</div>
<div class="log-content">
select * from SEGMENT_EVENTS.DBT_re_internal.re_data_run_started_at
</div>
<div class="log-summary">
Execution Time: 1.2s | Cost: 12 Snowflake credits
</div>
</div>
<!-- Add more log blocks as needed -->
</body>
</html>