A simple demo showcasing the integration of Snowflake Cortex Analyst with Slack. The demo also covers ChatOps aspects using the Snowflake Python API for setting up Snowflake resources such as databases, tables, stages, etc.
- Snowflake Account (get a free trial from https://signup.snowflake.com if needed)
- Snowflake CLI to setup your Snowflake connection locally. This will be used by the Slack-bot application when connecting to Snowflake.
- Snowflake KeyPair Authentication setup, as REST API will use JWT for secure communication
- A Slack Workspace where you can install this Slack-bot app. Learn how to create a Slack workspace
- Slack tokens setup - Follow the Bolt Python getting started guide
Note
Check out direnv for a neat and clean way to manage your environment variables.
Configure all required environment variables using .env
:
cp $DEMO_HOME/.env.example $DEMO/.env
Be sure to source the .env
file for local use with snow
. The app.py
automatically loads it if it exists.
Important
All code and packages have been tested with Python 3.11
python -m venv $DEMO_HOME/.venv
Install the required packages:
pip install -r requirements.txt
The Slack App configuration and its manifest are available in manifest.json. You can use this while setting up your Slack App. It includes all permissions, commands, and other details needed to interact with Snowflake using the bot.
Note
Ensure you have installed the Slack App in your workspace using the manifest
python app.py