diff --git a/Image Viewing with Pillow/README.md b/Image Viewing with Pillow/README.md index bb61819..4dcd769 100644 --- a/Image Viewing with Pillow/README.md +++ b/Image Viewing with Pillow/README.md @@ -2,15 +2,15 @@ This notebook is intended to be supplemental to the [Picture Perfect: Viewing Images with Snowpark for Python](https://medium.com/@btylerwhite/94f4c6a6a0f?source=friends_link&sk=487ac112536938f139707a1bdb84ddf1) article on Medium. -### Setting it up. +### Setting it up Clone the repo. If you're using macOS or Linux, execute the following commands: ``` -python3.8 -m venv venv +python -m venv venv source venv/bin/activate pip install -r Image\ Viewing\ with\ Pillow/requirements.txt ``` -### Preparing the Environment +### Notebook run -First, we will create a dedicated database and a few schemas to keep our data organized within the database. +The notebook will create the necessary objects and upload the images. diff --git a/Image Viewing with Pillow/notebook.ipynb b/Image Viewing with Pillow/notebook.ipynb index 3ffaaab..79f1812 100644 --- a/Image Viewing with Pillow/notebook.ipynb +++ b/Image Viewing with Pillow/notebook.ipynb @@ -1,32 +1,23 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This shorthand method of connecting assumes you have setup a configuration file as documented at\n", + "[Connecting using the connections.toml file](https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-connect#connecting-using-the-connections-toml-file).\n" + ] + }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ - "import os\n", - "\n", "import PIL.Image\n", "from snowflake.snowpark import Session\n", "\n", - "try:\n", - " from dotenv import load_dotenv\n", - "except ImportError:\n", - " def load_dotenv(**kwargs):\n", - " pass\n", - "\n", - "load_dotenv(override=True)\n", - "\n", - "connection_params = {\n", - " \"account\": os.environ.get(\"SNOWFLAKE_ACCOUNT\"),\n", - " \"user\": os.environ.get(\"SNOWFLAKE_USER\"),\n", - " \"password\": os.environ.get(\"SNOWFLAKE_PASSWORD\"),\n", - " \"role\": \"SYSADMIN\",\n", - "}\n", - "\n", - "session = Session.builder.configs(connection_params).create()" + "session = Session.builder.getOrCreate()" ] }, { @@ -34,7 +25,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Create the objects for this demonstration." + "Create the objects for this demonstration.\n" ] }, { @@ -76,7 +67,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Adjust our context." + "Adjust our context.\n" ] }, { @@ -95,7 +86,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Load the stage." + "Load the stage.\n" ] }, { @@ -124,7 +115,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "List the contents of the stage." + "List the contents of the stage.\n" ] }, { @@ -155,7 +146,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Stream and view the image." + "Stream and view the image.\n" ] }, { diff --git a/Image Viewing with Pillow/requirements.txt b/Image Viewing with Pillow/requirements.txt index 2daee9d..b1983df 100644 --- a/Image Viewing with Pillow/requirements.txt +++ b/Image Viewing with Pillow/requirements.txt @@ -1,4 +1,3 @@ ipykernel Pillow -python-dotenv snowflake-snowpark-python