Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

snowflake_config.txt 2.9 KB

You have to be logged in to leave a comment. Sign In
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
  1. MY_SNOWFLAKE_DATABASE.DAGSHUB_LEGO_SET_PROJECT.COLORSCREATE DATABASE my_snowflake_database;
  2. CREATE SCHEMA dagshub_lego_set_project;
  3. USE DATABASE my_snowflake_database;
  4. USE SCHEMA dagshub_lego_set_project;
  5. CREATE OR REPLACE STORAGE INTEGRATION mys3integration
  6. TYPE = EXTERNAL_STAGE
  7. STORAGE_PROVIDER = 'S3'
  8. ENABLED = TRUE
  9. STORAGE_AWS_ROLE_ARN = 'arn:aws:iam::088438813775:role/mysnowflakerole'
  10. STORAGE_ALLOWED_LOCATIONS = ('s3://lego-set-s3/');
  11. DESC INTEGRATION mys3integration;
  12. create table colors
  13. (
  14. id int null,
  15. name text null,
  16. rgb text null,
  17. is_trans text null
  18. );
  19. create or replace warehouse mywarehouse with
  20. warehouse_size = 'X-SMALL'
  21. auto_suspend = 120
  22. auto_resume = true
  23. initially_suspended = true;
  24. create or replace file format mycsvformat
  25. type = 'CSV'
  26. field_delimiter = ','
  27. record_delimiter = '\n'
  28. skip_header = 1
  29. FIELD_OPTIONALLY_ENCLOSED_BY = '0x22'
  30. ;
  31. create or replace stage mycsvstage
  32. storage_integration = mys3integration
  33. file_format = mycsvformat
  34. url = 's3://lego-set-s3/data/';
  35. show stages;
  36. list @~;
  37. alter warehouse mywarehouse resume;
  38. copy into colors
  39. from @mycsvstage/colors.csv
  40. on_error = 'skip_file';
  41. select * from colors;
  42. create table inventories
  43. (
  44. id int null,
  45. version int null,
  46. set_num text null
  47. );
  48. create table inventory_parts
  49. (
  50. inventory_id int null,
  51. part_num text null,
  52. color_id int null,
  53. quantity int null,
  54. is_spare text null
  55. );
  56. create table inventory_sets
  57. (
  58. inventory_id int null,
  59. set_num text null,
  60. quantity int null
  61. );
  62. create table part_categories
  63. (
  64. id int null,
  65. name text null
  66. );
  67. create table parts
  68. (
  69. part_num text null,
  70. name text null,
  71. part_cat_id int null
  72. );
  73. create table set_price
  74. (
  75. id text null,
  76. name text null,
  77. category text null,
  78. year double null,
  79. parts double null,
  80. img_link text null,
  81. set_link text null,
  82. raw_price text null,
  83. mean_price double null
  84. );
  85. create table sets
  86. (
  87. set_num text null,
  88. name text null,
  89. year int null,
  90. theme_id int null,
  91. num_parts int null
  92. );
  93. create table themes
  94. (
  95. id int null,
  96. name text null,
  97. parent_id int null
  98. );
  99. copy into inventories
  100. from @mycsvstage/inventories.csv
  101. on_error = 'skip_file';
  102. copy into inventory_parts
  103. from @mycsvstage/inventory_parts.csv
  104. on_error = 'skip_file';
  105. copy into inventory_sets
  106. from @mycsvstage/inventory_sets.csv
  107. on_error = 'skip_file';
  108. copy into parts
  109. from @mycsvstage/parts.csv
  110. on_error = 'skip_file';
  111. copy into part_categories
  112. from @mycsvstage/part_categories.csv
  113. on_error = 'skip_file';
  114. copy into sets
  115. from @mycsvstage/sets.csv
  116. on_error = 'skip_file';
  117. copy into set_price
  118. from @mycsvstage/set_price.csv
  119. on_error = 'skip_file';
  120. copy into themes
  121. from @mycsvstage/themes.csv
  122. on_error = 'skip_file';
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...