Skip to content

Commit bf088ca

Browse files
SNOW-1344601-datamapping-repo-update (snowflakedb#2)
minor changes to keep up with quickstart
1 parent 99adc82 commit bf088ca

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

data-mapping/app/manifest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
manifest_version: 1
22
artifacts:
3+
readme: README.md
34
setup_script: setup_script.sql
45
default_streamlit: ui."Dashboard"
56

data-mapping/prepare_data.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
# Create a database and a schema to hold the data to lookup.
12
snow sql -q "
23
CREATE DATABASE IF NOT EXISTS IP2LOCATION;
34
CREATE SCHEMA IF NOT EXISTS IP2LOCATION;
45
"
6+
# Create the table to host the data.
7+
# Create a file format for the file
8+
# Create a stage so we can upload the file
59

610
snow sql -q "
711
CREATE TABLE IF NOT EXISTS LITEDB11 (
@@ -27,22 +31,30 @@ COMPRESSION = AUTO;
2731
CREATE STAGE IF NOT EXISTS IP2LOCATION.IP2LOCATION.LOCATION_DATA_STAGE
2832
file_format = LOCATION_CSV;" --database ip2location --schema ip2location
2933

34+
# Copy the csv files from your local machine to the stage we created previously
3035
snow stage copy /USER_PATH_HERE/IP2LOCATION-LITE-DB11.CSV @location_data_stage --database ip2location --schema ip2location
3136

37+
# Copy the csv file from the stage to load the table
3238
snow sql -q "
3339
copy into litedb11 from @location_data_stage
3440
files = ('IP2LOCATION-LITE-DB11.CSV')
3541
;" --database ip2location --schema ip2location
3642

43+
# Simple query test to ensure the table is correctly filled.
3744
snow sql -q "SELECT COUNT(*) FROM LITEDB11;
3845
SELECT * FROM LITEDB11 LIMIT 10;" --database ip2location --schema ip2location
3946

47+
# Create test database and schema.
4048
snow sql -q "CREATE DATABASE IF NOT EXISTS TEST_IPLOCATION;
41-
CREATE SCHEMA IF NOT EXISTS TEST_IPLOCATION;
49+
CREATE SCHEMA IF NOT EXISTS TEST_IPLOCATION;"
4250

51+
# Create test table to insert some values
52+
snow sql -q "
4353
CREATE OR REPLACE TABLE TEST_IPLOCATION.TEST_IPLOCATION.TEST_DATA (
4454
IP VARCHAR(16),
4555
IP_DATA VARIANT
46-
);
56+
);"
4757

48-
INSERT INTO TEST_IPLOCATION.TEST_IPLOCATION.TEST_DATA(IP) VALUES('73.153.199.206'),('8.8.8.8');"
58+
# Insert testing values to use later on
59+
snow sql -q "
60+
INSERT INTO TEST_IPLOCATION.TEST_IPLOCATION.TEST_DATA(IP) VALUES('73.153.199.206'),('8.8.8.8');"
File renamed without changes.

data-mapping/snowflake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ native_app:
77
dest: ./
88
package:
99
scripts:
10-
- scripts/setup-package-script.sql
10+
- scripts/setup_package_script.sql

0 commit comments

Comments
 (0)