Snowflake Setup CLI
Archived experimental setup CLI with Copilot Agent assistance for the EvSnow project.
Archived tool
This page is kept for project history. The current supported setup path is Snowflake quickstart, which uses checked-in SQL and the Snowflake CLI. Do not use this page as the first-run setup guide.
This tool is experimental and setup-only. It can generate Programmatic Access Token SQL restricted to an administrative setup role. Do not use those tokens for runtime ingestion or query access.
Overview
This CLI tool guides you through complete Snowflake infrastructure setup using an AI-powered agent (GitHub Copilot SDK). It automates the process described in Complete Snowflake setup.
Prerequisites
- Python 3.13+
- uv package manager
- Snowflake account with ACCOUNTADMIN access
- GitHub Copilot CLI installed and authenticated
- Snow CLI installed (
pip install snowflake-clior via homebrew)
Installation
# Navigate to the tool directory
cd tools/snowflake_setup
# Install dependencies with uv
uv sync
# Or install in development mode
uv pip install -e .
Usage
Interactive Setup
# Run the setup wizard (will prompt for inputs)
uv run python -m main setup
# Or with arguments
uv run python -m main setup --account <account_identifier> --user <admin_user>
Command Options
| Option | Short | Description | Default |
|---|---|---|---|
--account |
-a |
Snowflake account identifier | (prompted) |
--user |
-u |
Snowflake username | (prompted) |
--token-name |
-t |
Name for the PAT token | EVSNOW_SETUP_PAT |
--days |
-d |
Days until PAT expires | 90 |
How It Works
Step 1: PAT Generation
The CLI generates SQL to create a setup-only Programmatic Access Token (PAT). Use the narrowest administrative setup role your organization allows.
ALTER USER <username> ADD PROGRAMMATIC ACCESS TOKEN <token_name>
ROLE_RESTRICTION = '<SETUP_ADMIN_ROLE>'
DAYS_TO_EXPIRY = 90;
You run this SQL in Snowflake and provide the resulting token.
Step 2: AI Agent Setup
The Copilot agent then:
- Creates Snow CLI connection using PAT authentication
- Tests the connection and troubleshoots any issues
- Uses Snowflake-managed internal Iceberg storage by default
- Executes full setup following Complete Snowflake setup:
- Creates STREAM role and STREAMEV user
- Generates RSA keys
- Creates INGESTION and CONTROL databases
- Creates a Snowflake-managed internal Iceberg table and streaming pipe
- Sets up all necessary grants
Step 3: Output
The agent provides:
- Summary of all created objects
.envfile content for configuration- Any manual steps needed
Architecture
snowflake_setup/
├── __init__.py # Package metadata
├── main.py # Typer CLI entry point
├── sql_templates.py # PAT SQL generation
├── prompts.py # Agent system prompts
├── agent.py # Copilot SDK wrapper
├── pyproject.toml # Package dependencies
└── README.md # This file
Security Notes
- PAT tokens are stored in temporary files with
0600permissions - Token files are deleted after use
- Never commit tokens to version control
- Administrative PATs should only be used for one-time setup
Troubleshooting
Snow CLI not found
Copilot CLI not authenticated
Connection fails
- Verify account format (e.g.,
<account_identifier>) - Check network connectivity
- Ensure PAT hasn't expired
- Verify ACCOUNTADMIN role access
Related Files
- Complete Snowflake setup - Full setup guide
.env.example- Environment variable template