Skip to content

Quickstart

This guide walks you through installing the SDK, authenticating, and running your first query.

  • Python 3.11, 3.12 or 3.13 (>=3.11, <3.14)

In a new directory, initialize a new uv project:

Terminal window
uv init --python "python >=3.11, <3.14"

Then, install the SDK:

Terminal window
uv add komodo

Verify installation:

Terminal window
uv run komodo --help

Start the OAuth login flow:

Terminal window
uv run komodo login

Follow the browser prompt to authenticate with your Komodo credentials.

Terminal window
uv run komodo account set

Select your account from the interactive list.

Create a file first_query.py:

import warnings
from komodo import get_snowflake_connection
# Suppress pandas warning about non-SQLAlchemy connections
warnings.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:

Terminal window
uv run first_query.py
  1. **Created a new uv project
  2. Installed the SDK from PyPI
  3. Authenticated using OAuth 2.0 device flow
  4. Selected your Komodo account
  5. Executed a SQL query against Snowflake
  6. Retrieved results using standard DB-API 2.0 patterns