From 141ab3ed70a8216b455a0276e02461f365adba33 Mon Sep 17 00:00:00 2001 From: jayshreepravin Date: Fri, 23 May 2025 08:18:29 +0000 Subject: [PATCH 1/3] changes to UDF --- .devcontainer/connections.toml | 8 ++++---- .../fahrenheit_to_celsius_udf/function.py | 4 +++- steps/05_fahrenheit_to_celsius_udf/requirements.txt | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.devcontainer/connections.toml b/.devcontainer/connections.toml index 0acd64c3..f1e31b8b 100644 --- a/.devcontainer/connections.toml +++ b/.devcontainer/connections.toml @@ -2,10 +2,10 @@ #export SNOWFLAKE_DEFAULT_CONNECTION_NAME="default" [default] -account = "myaccount" -user = "myuser" -password = "mypassword" +account = "XKFAXIW.OHB38790" +user = "jayshreemankape" +password = "eMvgH8dqhybS9W8" role = "HOL_ROLE" warehouse = "HOL_WH" database = "HOL_DB" -schema = "ANALYTICS" +schema = "HARMONIZED" diff --git a/steps/05_fahrenheit_to_celsius_udf/fahrenheit_to_celsius_udf/function.py b/steps/05_fahrenheit_to_celsius_udf/fahrenheit_to_celsius_udf/function.py index e52520cc..cf7d5a9e 100644 --- a/steps/05_fahrenheit_to_celsius_udf/fahrenheit_to_celsius_udf/function.py +++ b/steps/05_fahrenheit_to_celsius_udf/fahrenheit_to_celsius_udf/function.py @@ -10,9 +10,11 @@ # SNOWFLAKE ADVANTAGE: SnowCLI (PuPr) import sys + +from scipy.constants import convert_temperature def main(temp_f: float) -> float: - return (float(temp_f) - 32) * (5/9) + return convert_temperature(float(temp_f), 'F', 'C') # For local debugging diff --git a/steps/05_fahrenheit_to_celsius_udf/requirements.txt b/steps/05_fahrenheit_to_celsius_udf/requirements.txt index ed706cf0..84b64041 100644 --- a/steps/05_fahrenheit_to_celsius_udf/requirements.txt +++ b/steps/05_fahrenheit_to_celsius_udf/requirements.txt @@ -1 +1,2 @@ snowflake-snowpark-python +sc \ No newline at end of file From bc77522a0b8f9dec916ac42b41192ed850ae1924 Mon Sep 17 00:00:00 2001 From: jayshreepravin Date: Fri, 23 May 2025 08:29:34 +0000 Subject: [PATCH 2/3] Initial commit From aed6cbc1a501d0b9c6316dd134d0431ff44a6562 Mon Sep 17 00:00:00 2001 From: jayshreepravin Date: Sat, 24 May 2025 15:08:08 +0530 Subject: [PATCH 3/3] deployment1.yml --- .github/workflows/main.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..cd1441c3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,37 @@ +name: Deploy Snowpark Apps + +# Controls when the action will run. +on: + push: + branches: + - main + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install Python packages + run: pip install -r requirements.txt + + - name: Deploy Snowpark apps + env: + SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} + SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }} + SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }} + SNOWFLAKE_ROLE: ${{ secrets.SNOWFLAKE_ROLE }} + SNOWFLAKE_WAREHOUSE: ${{ secrets.SNOWFLAKE_WAREHOUSE }} + SNOWFLAKE_DATABASE: ${{ secrets.SNOWFLAKE_DATABASE }} + run: python deploy_snowpark_apps.py $GITHUB_WORKSPACE