DEV Community

FlyingBanana
FlyingBanana

Posted on

Unlocking Interactive Visualizations in Jupyter Notebook: PyGWalker Meets Snowflake

In the evolving world of data analysis, interactivity and user experience play a pivotal role. Analysts need solutions that are both powerful in handling large datasets and flexible in presenting insights. PyGWalker is an intriguing solution that offers the ability to turn your Pandas dataframes into interactive visualizations right within your Jupyter notebooks. Essentially, it serves as an open-source alternative to heavyweight visualization platforms like Tableau and PowerBI.

In this article, we'll explore how you can supercharge PyGWalker by integrating it with Snowflake, a cloud data platform known for its capability to process enormous datasets efficiently.

pygwalker + snowflake to visual earthquake data

Getting Started

Installation

To kick things off, you need to install the pygwalker library and the accompanying Snowflake plugin. Use the pip commands below:

pip install --upgrade --pre pygwalker
pip install --upgrade --pre "pygwalker[snowflake]" 
Enter fullscreen mode Exit fullscreen mode

Setting Up The Connector

The primary step in integrating PyGWalker with Snowflake is setting up a connector. This allows the library to fetch data directly from Snowflake databases and turn it into interactive plots.

Here's a quick code snippet to guide you:

import pygwalker as pyg
from pygwalker.data_parsers.database_parser import Connector

conn = Connector(
    "snowflake://user_name:password@account_identifier/database/schema",
    """
        SELECT
            *
        FROM
            SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.ORDERS
    """
)

walker = pyg.walk(conn)
Enter fullscreen mode Exit fullscreen mode

Note: Ensure that you replace the placeholders in the connection string with your Snowflake credentials.

Understanding The Connection String

Snowflake provides two formats for the connection string:

  1. Account Name Format:
   snowflake://<user_login_name>:<password>@<orgname>-<account_name>
Enter fullscreen mode Exit fullscreen mode
  1. Account Locator Format:
   snowflake://<user_login_name>:<password>@<account_locator>.<region_id>.<cloud>
Enter fullscreen mode Exit fullscreen mode

Choose the format that best suits your Snowflake setup.

Wrapping Up

With PyGWalker's integration with Snowflake, analysts can now effortlessly visualize vast datasets right within their Jupyter notebooks. This synergy transforms data analysis workflows, offering both depth and ease. So the next time you're looking for a nimble yet powerful data visualization solution, consider giving PyGWalker and Snowflake a whirl!

Related resources

pygwalker + snowflake official doc

Top comments (0)