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/.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 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