Core Products·Prithivi Raj (with Ancy for Databricks)·4 min read

TeksOptima: connect Snowflake (push or OAuth) and Databricks, read the savings

Complete guide to cloud data platform cost optimization: connect Snowflake via push script or OAuth, connect Databricks, read warehouse health metrics, and capture 30–60% credit savings.

TeksOptima is Tekspaz’s continuous cloud cost and performance optimization engine for enterprise data platforms. It targets Snowflake and Databricks, routinely uncovering 30% to 60% in compute credit savings without impacting query performance or analyst workloads.

TeksOptima operates with native zero-credential tenancy: it reads only query history and warehouse telemetry metadata. Your actual table data never leaves your account.


1. How TeksOptima achieves 30–60% savings

Most data platform spend is lost to compute that stays awake when idle, oversized warehouses running small queries, and inefficient scans. TeksOptima attacks these via three levers:

  1. Idle Time & Schedules (17% avg savings): Eliminating 0-auto-suspend warehouses, dynamically right-sizing quiet-hour compute, and preventing idle clusters from burning credits.
  2. Warehouse Right-Sizing (16% avg savings): Matching warehouse sizes (X-Small through 4X-Large) and cluster scaling policies to actual workload patterns.
  3. Scan & Query Routing Efficiency (12% avg savings): Routing ad-hoc analyst queries to optimal warehouses using a hybrid rules engine and predictive ML model.

2. Connecting Snowflake

You can connect your Snowflake account using either the Push script (recommended for security-restricted environments) or Direct OAuth.

The push method runs a small read-only extraction SQL script inside your Snowflake account, generating a token that you paste into Tekspaz. No external network inbound access into Snowflake is required.

  1. In Tekspaz, navigate to Settings › Connections › TeksOptima (/settings).
  2. Copy the initialization SQL script provided:
    -- Create read-only role and user for FinOps telemetry
    USE ROLE ACCOUNTADMIN;
    CREATE ROLE IF NOT EXISTS TEKSOPTIMA_READER;
    GRANT IMPORTED PRIVILEGES ON DATABASE SNOWFLAKE TO ROLE TEKSOPTIMA_READER;
    GRANT MONITOR USAGE ON ACCOUNT TO ROLE TEKSOPTIMA_READER;
    
    -- Generate a scoped read token (starts with tksr_...)
    CALL SNOWFLAKE.ML.GENERATE_TELEMETRY_TOKEN('TEKSOPTIMA_READER', 30);
  3. Run the script in your Snowflake Snowsight worksheet.
  4. Copy the generated read token (starts with tksr_...).
  5. Paste the token into the TeksOptima read token input in Tekspaz Settings and click Connect TeksOptima.

Tekspaz validates the token against TeksOptima’s contract and securely links your workspace.

sequenceDiagram
    autonumber
    actor Admin as Snowflake Admin
    participant Snow as Snowflake (Your Tenancy)
    participant Teks as Tekspaz Platform
    Admin->>Snow: Run Read-Only Telemetry Script
    Snow-->>Admin: Issue Token (tksr_...)
    Admin->>Teks: Paste Token in Settings › Connections
    Teks->>Teks: Validate Contract & Encrypt Token
    Teks-->>Admin: Connected & Synced

Method B: Snowflake OAuth

If your organization prefers managed OAuth:

  1. In Settings › Connections, click Connect Snowflake with OAuth.
  2. Sign in to your Snowflake account with an account administrator or FinOps role.
  3. Review requested permissions: IMPORTED PRIVILEGES ON DATABASE SNOWFLAKE and MONITOR ON WAREHOUSE.
  4. Click Allow.
  5. Once redirected back, select which warehouses you wish to include in cost monitoring.

3. Connecting Databricks

Connecting Databricks enables cluster sizing optimization, photon engine right-sizing, and SQL warehouse idle suspend monitoring.

Setup Steps

  1. In Settings › Connections, select Databricks.
  2. Enter your Databricks Workspace URL (e.g. https://dbc-abc12345-1234.cloud.databricks.com).
  3. Generate a Personal Access Token (PAT) or Service Principal Token in your Databricks workspace:
    • Navigate to User Settings › Developer › Access tokens.
    • Generate a token with the comment tekspaz-optima-monitor.
    • Grant read permission on the system.billing.usage and system.compute.clusters system tables.
  4. Paste the token into Tekspaz and click Save Connection.
  5. Tekspaz checks connectivity and begins ingesting 30-day cluster metrics.

4. Reading the savings dashboard

Open your project’s TeksOptima tab (/projects/[id]/optima):

1. Warehouse Health & Heatmap

  • 30-Day Load Heatmap: Visualizes hourly weekday and weekend utilization across every warehouse. Dark blue indicates high queueing; light gray indicates idle waste.
  • Auto-Suspend Health: Flags any warehouse configured with AUTO_SUSPEND = 0 (always on) or excessive timeouts (> 10 minutes for interactive warehouses).

2. Spend Forecast & Anomaly Detection

  • Displays your 7-day projected credit burn against historical 28-day averages.
  • Flags anomaly spikes (> 3σ above the mean) with immediate drill-down to the offending queries.

3. Query Router ML Second Opinion

  • Shows recommendations where queries can be routed to a smaller or alternative warehouse tier without latency penalty.
  • Each recommendation carries both the deterministic SQL rule verdict and a machine learning confidence score. Suggestions with confidence under 70% are automatically withheld.

5. Applying and reversing recommendations

TeksOptima never alters your production infrastructure without verification:

  1. In the Savings tab (/projects/[id]/optima/savings), inspect the list of recommended actions.
  2. Click on a recommendation (e.g. Resize ANALYTICS_WH from Large to Medium during 20:00–06:00 UTC).
  3. Inspect the Generated SQL:
    -- TeksOptima generated execution
    ALTER WAREHOUSE ANALYTICS_WH SET WAREHOUSE_SIZE = 'MEDIUM';
    ALTER WAREHOUSE ANALYTICS_WH SET AUTO_SUSPEND = 120;
  4. Inspect the Reversal Script:
    -- Instant rollback script
    ALTER WAREHOUSE ANALYTICS_WH SET WAREHOUSE_SIZE = 'LARGE';
    ALTER WAREHOUSE ANALYTICS_WH SET AUTO_SUSPEND = 600;
  5. Click Apply Change. The update takes effect immediately, and TeksOptima begins tracking the real-time credit savings!

What to explore next

Ask the DocsAI Assistant

Instant answers grounded in our guides with direct links to sources.

Suggestions:

Have questions about this guide?

Our founding engineering team is ready to help you get started.

Contact Support