-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy path02-load-fabric-dw-tpch-template.sql
177 lines (147 loc) · 5.14 KB
/
02-load-fabric-dw-tpch-template.sql
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
--Declaring Variables
--11/6/2023 0:20:16 @F64
SELECT 'Job started', GETDATE()
DECLARE @StartTime datetime
DECLARE @EndTime datetime
DECLARE @TotalStartTime datetime
DECLARE @TotalEndTime datetime
SELECT @TotalStartTime=GETDATE();
--Ingest nation
SELECT @StartTime=GETDATE()
COPY INTO nation from 'https://<mystorage>.dfs.core.windows.net/tpch1tb/nation/'
WITH
(
FILE_TYPE = 'CSV',
CREDENTIAL=(IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
ERRORFILE = 'https://<mystorage>.dfs.core.windows.net/tpch1tb/error_files',
ERRORFILE_CREDENTIAL = (IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
FIELDQUOTE = '"',
FIELDTERMINATOR='|',
ROWTERMINATOR='0x0A',
ENCODING = 'UTF8',
FIRSTROW = 1
);
SELECT @EndTime=GETDATE()
SELECT 'Ingest nation elapsed time', DATEDIFF(ss,@StartTime,@EndTime)
--Ingest region
SELECT @StartTime=GETDATE()
COPY INTO region from 'https://<mystorage>.dfs.core.windows.net/tpch1tb/region/'
WITH
(
FILE_TYPE = 'CSV',
CREDENTIAL=(IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
ERRORFILE = 'https://<mystorage>.dfs.core.windows.net/tpch1tb/error_files',
ERRORFILE_CREDENTIAL = (IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
FIELDQUOTE = '"',
FIELDTERMINATOR='|',
ROWTERMINATOR='0x0A',
ENCODING = 'UTF8',
FIRSTROW = 1
);
SELECT @EndTime=GETDATE()
SELECT 'Ingest region elapsed time', DATEDIFF(ss,@StartTime,@EndTime)
--Ingest customer
SELECT @StartTime=GETDATE()
COPY INTO customer from 'https://<mystorage>.dfs.core.windows.net/tpch1tb/customer/'
WITH
(
FILE_TYPE = 'CSV',
CREDENTIAL=(IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
ERRORFILE = 'https://<mystorage>.dfs.core.windows.net/tpch1tb/error_files',
ERRORFILE_CREDENTIAL = (IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
FIELDQUOTE = '"',
FIELDTERMINATOR='|',
ROWTERMINATOR='0x0A',
ENCODING = 'UTF8',
FIRSTROW = 1
);
SELECT @EndTime=GETDATE()
SELECT 'Ingest customer elapsed time', DATEDIFF(ss,@StartTime,@EndTime)
--Ingest supplier
SELECT @StartTime=GETDATE()
COPY INTO supplier from 'https://<mystorage>.dfs.core.windows.net/tpch1tb/supplier/'
WITH
(
FILE_TYPE = 'CSV',
CREDENTIAL=(IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
ERRORFILE = 'https://<mystorage>.dfs.core.windows.net/tpch1tb/error_files',
ERRORFILE_CREDENTIAL = (IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
FIELDQUOTE = '"',
FIELDTERMINATOR='|',
ROWTERMINATOR='0x0A',
ENCODING = 'UTF8',
FIRSTROW = 1
);
SELECT @EndTime=GETDATE()
SELECT 'Ingest supplier elapsed time', DATEDIFF(ss,@StartTime,@EndTime)
--Ingest part
SELECT @StartTime=GETDATE()
COPY INTO part from 'https://<mystorage>.dfs.core.windows.net/tpch1tb/part/'
WITH
(
FILE_TYPE = 'CSV',
CREDENTIAL=(IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
ERRORFILE = 'https://<mystorage>.dfs.core.windows.net/tpch1tb/error_files',
ERRORFILE_CREDENTIAL = (IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
FIELDQUOTE = '"',
FIELDTERMINATOR='|',
ROWTERMINATOR='0x0A',
ENCODING = 'UTF8',
FIRSTROW = 1
);
SELECT @EndTime=GETDATE()
SELECT 'Ingest part elapsed time', DATEDIFF(ss,@StartTime,@EndTime)
--Ingest partsupp
SELECT @StartTime=GETDATE()
COPY INTO partsupp from 'https://<mystorage>.dfs.core.windows.net/tpch1tb/partsupp/'
WITH
(
FILE_TYPE = 'CSV',
CREDENTIAL=(IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
ERRORFILE = 'https://<mystorage>.dfs.core.windows.net/tpch1tb/error_files',
ERRORFILE_CREDENTIAL = (IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
FIELDQUOTE = '"',
FIELDTERMINATOR='|',
ROWTERMINATOR='0x0A',
ENCODING = 'UTF8',
FIRSTROW = 1
);
SELECT @EndTime=GETDATE()
SELECT 'Ingest partsupp elapsed time', DATEDIFF(ss,@StartTime,@EndTime)
--Ingest orders
SELECT @StartTime=GETDATE()
COPY INTO orders from 'https://<mystorage>.dfs.core.windows.net/tpch1tb/orders/'
WITH
(
FILE_TYPE = 'CSV',
CREDENTIAL=(IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
ERRORFILE = 'https://<mystorage>.dfs.core.windows.net/tpch1tb/error_files',
ERRORFILE_CREDENTIAL = (IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
FIELDQUOTE = '"',
FIELDTERMINATOR='|',
ROWTERMINATOR='0x0A',
ENCODING = 'UTF8',
FIRSTROW = 1
);
SELECT @EndTime=GETDATE()
SELECT 'Ingest orders elapsed time', DATEDIFF(ss,@StartTime,@EndTime)
--Ingest lineitem
SELECT @StartTime=GETDATE()
COPY INTO lineitem from 'https://<mystorage>.dfs.core.windows.net/tpch1tb/lineitem/'
WITH
(
FILE_TYPE = 'CSV',
CREDENTIAL=(IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
ERRORFILE = 'https://<mystorage>.dfs.core.windows.net/tpch1tb/error_files',
ERRORFILE_CREDENTIAL = (IDENTITY= 'Shared Access Signature', SECRET='<mySASkey>'),
FIELDQUOTE = '"',
FIELDTERMINATOR='|',
ROWTERMINATOR='0x0A',
ENCODING = 'UTF8',
FIRSTROW = 1
);
SELECT @EndTime=GETDATE()
SELECT 'Ingest lineitem elapsed time', DATEDIFF(ss,@StartTime,@EndTime)
SELECT @TotalEndTime=GETDATE()
SELECT 'TPCH Ingestion Total elapsed time', DATEDIFF(ss,@TotalStartTime,@TotalEndTime)
SELECT 'Job Ended', GETDATE()