Skip to content

Commit 945c056

Browse files
Merge pull request #14 from sfc-gh-vraudszus/main
Cover new CoAs, PythonAPI and CLI features
2 parents c1cb092 + 901c32d commit 945c056

15 files changed

+337
-172
lines changed

.devcontainer/devcontainer.json

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1-
// For format details, see https://aka.ms/devcontainer.json.
21
{
3-
"name": "Snowflake Demo Codespace",
4-
// Configure tool-specific properties.
5-
"customizations": {
6-
"vscode": {
7-
"extensions": [
8-
"snowflake.snowflake-vsc"
9-
]
2+
"name": "Snowflake Demo Codespace",
3+
"features": {
4+
"ghcr.io/devcontainers/features/python:1": {
5+
"version": "3.11"
6+
}
7+
},
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"ms-python.python",
12+
"snowflake.snowflake-vsc"
13+
],
14+
"settings": {
15+
"snowflake.snowsqlConfigPath": "${containerWorkspaceFolder}/.snowflake/config.toml"
1016
}
1117
}
12-
}
18+
},
19+
"updateContentCommand": "bash .devcontainer/install-dependencies.sh",
20+
"postCreateCommand": "chmod 0600 \"${containerWorkspaceFolder}/.snowflake/config.toml\"",
21+
"containerEnv": {
22+
"SNOWFLAKE_HOME": "${containerWorkspaceFolder}/.snowflake"
23+
}
24+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
pip install snowflake-snowpark-python
3+
pip install snowflake.core
4+
pipx install snowflake-cli --python 3.11

.github/workflows/deploy_pipeline.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ jobs:
2727
uses: actions/checkout@v4
2828

2929
# Install Snowflake CLI GitHub Action and point to config file
30-
- uses: Snowflake-Labs/snowflake-cli-action@v1
30+
- name: Install snowflake-cli
31+
uses: Snowflake-Labs/snowflake-cli-action@v1.5
3132
with:
3233
cli-version: "latest"
33-
default-config-file-path: "config.toml"
34+
default-config-file-path: ".snowflake/config.toml"
3435

3536
# Update Snowflake's copy of the repository
3637
- name: Fetch repository changes
@@ -42,10 +43,10 @@ jobs:
4243
BRANCH_NAME=${{ github.ref_name }}
4344
if [ "${BRANCH_NAME}" == "main" ]; then
4445
RETENTION_TIME=1
45-
elif [ "${BRANCH_NAME}" == "dev" ]; then
46+
else
4647
RETENTION_TIME=0
4748
fi
4849
snow git execute \
49-
"@${REPO_NAME}/branches/${BRANCH_NAME}/deploy_parametrized_pipeline.sql" \
50+
"@${REPO_NAME}/branches/${BRANCH_NAME}/steps/0[134]_*" \
5051
-D "environment='${BRANCH_NAME}'" \
5152
-D "retention_time=${RETENTION_TIME}"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.snowflake/logs

.snowflake/config.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[connections.default]
2+
warehouse = "QUICKSTART_WH"
3+
role = "ACCOUNTADMIN"
4+
database = "QUICKSTART_COMMON"
5+
schema = "PUBLIC"
6+
account = "<INSERT YOUR ACCOUNT IDENTIFIER>"
7+
user = "<INSERT YOUR USERNAME>"
8+
password = "<INSERT YOUR PASSWORD>"

config.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

deploy_parametrized_pipeline.sql

Lines changed: 0 additions & 3 deletions
This file was deleted.

deploy_pipeline.sql

Lines changed: 0 additions & 3 deletions
This file was deleted.

steps/01_setup_snowflake.sql

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
USE ROLE ACCOUNTADMIN;
22

3-
CREATE WAREHOUSE IF NOT EXISTS QUICKSTART_WH WAREHOUSE_SIZE = XSMALL, AUTO_SUSPEND = 300, AUTO_RESUME= TRUE;
3+
CREATE OR ALTER WAREHOUSE QUICKSTART_WH
4+
WAREHOUSE_SIZE = XSMALL
5+
AUTO_SUSPEND = 300
6+
AUTO_RESUME= TRUE;
47

58

69
-- Separate database for git repository
7-
CREATE DATABASE IF NOT EXISTS QUICKSTART_COMMON;
10+
CREATE OR ALTER DATABASE QUICKSTART_COMMON;
811

912

1013
-- API integration is needed for GitHub integration
@@ -20,7 +23,7 @@ CREATE OR REPLACE GIT REPOSITORY quickstart_common.public.quickstart_repo
2023
ORIGIN = '<insert URL of forked GitHub repo>'; -- INSERT URL OF FORKED REPO HERE
2124

2225

23-
CREATE OR REPLACE DATABASE QUICKSTART_PROD;
26+
CREATE OR ALTER DATABASE QUICKSTART_PROD;
2427

2528

2629
-- To monitor data pipeline's completion
@@ -30,14 +33,14 @@ CREATE OR REPLACE NOTIFICATION INTEGRATION email_integration
3033

3134

3235
-- Database level objects
33-
CREATE SCHEMA IF NOT EXISTS bronze;
34-
CREATE SCHEMA IF NOT EXISTS silver;
35-
CREATE SCHEMA IF NOT EXISTS gold;
36+
CREATE OR ALTER SCHEMA bronze;
37+
CREATE OR ALTER SCHEMA silver;
38+
CREATE OR ALTER SCHEMA gold;
3639

3740

3841
-- Schema level objects
3942
CREATE OR REPLACE FILE FORMAT bronze.json_format TYPE = 'json';
40-
CREATE OR REPLACE STAGE bronze.raw;
43+
CREATE OR ALTER STAGE bronze.raw;
4144

4245

4346
-- Copy file from GitHub to internal stage

steps/02_access_marketplace_data.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ USE ROLE ACCOUNTADMIN;
44
SELECT * FROM oag_flight_emissions_data_sample.public.estimated_emissions_schedules_sample LIMIT 100;
55
SELECT * FROM oag_flight_status_data_sample.public.flight_status_latest_sample LIMIT 100;
66
SELECT * FROM global_weather__climate_data_for_bi.standard_tile.forecast_day LIMIT 100;
7-
SELECT * FROM government_essentials.cybersyn.datacommons_timeseries LIMIT 100;
8-
SELECT * FROM us_points_of_interest__addresses.cybersyn.point_of_interest_index LIMIT 100;
7+
SELECT * FROM global_government.cybersyn.datacommons_timeseries LIMIT 100;
8+
SELECT * FROM us_addresses__poi.cybersyn.point_of_interest_index LIMIT 100;

0 commit comments

Comments
 (0)