Quickstart
This guide walks you through installing the SDK, authenticating, and running your first query.
Prerequisites
Section titled “Prerequisites”- Python 3.11, 3.12 or 3.13 (
>=3.11, <3.14)
Step 1: Install
Section titled “Step 1: Install”In a new directory, initialize a new uv project:
uv init --python "python >=3.11, <3.14"Then, install the SDK:
uv add komodoVerify installation:
uv run komodo --helpStep 2: Authenticate
Section titled “Step 2: Authenticate”Start the OAuth login flow:
uv run komodo loginFollow the browser prompt to authenticate with your Komodo credentials.
Step 3: Set Your Account
Section titled “Step 3: Set Your Account”uv run komodo account setSelect your account from the interactive list.
Step 4: Run Your First Query
Section titled “Step 4: Run Your First Query”Create a file first_query.py:
import warningsfrom komodo import get_snowflake_connection
# Suppress pandas warning about non-SQLAlchemy connectionswarnings.filterwarnings("ignore", message="pandas only supports SQLAlchemy connectable")
# The SDK can also get a Snowflake connection and execute queries.# This is a simple DBAPI2.0 wrapper that communicates with snowflake via proxy.# Get the connection and cursor
def demo_get_all(): print("Fetching all at once") conn = get_snowflake_connection() cursor = conn.cursor() cursor.execute("USE DATABASE DATA") query = "SELECT column_name, table_name FROM INFORMATION_SCHEMA.COLUMNS;"
# Fetch the result set from the cursor and deliver it as the pandas DataFrame. cursor.execute(query) df_all = cursor.fetch_pandas_all() # https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-api#fetch_pandas_all print(df_all.head(20)) print("total rows:", len(df_all))
def demo_get_batches(): print("Fetching in batches") conn = get_snowflake_connection() cursor = conn.cursor() cursor.execute("USE DATABASE DATA") query = "SELECT column_name, table_name FROM INFORMATION_SCHEMA.COLUMNS;"
cursor.execute(query) # Fetch the result set from the cursor and deliver it as the pandas DataFrame. # https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-api#fetch_pandas_batches for df in cursor.fetch_pandas_batches(): print("New batch:") print("total rows in batch:", len(df)) print(df)
if __name__ == "__main__": demo_get_all() demo_get_batches()Run it:
uv run first_query.pyWhat You Just Did
Section titled “What You Just Did”- **Created a new uv project
- Installed the SDK from PyPI
- Authenticated using OAuth 2.0 device flow
- Selected your Komodo account
- Executed a SQL query against Snowflake
- Retrieved results using standard DB-API 2.0 patterns