Actiknow
Data Engineering

Snowflake Python on Warehouse Compute: When Code Bundles Are Simpler Than Stored Procedures

Compare Snowflake Python Code Bundles on warehouse compute with stored procedures. Learn deployment, cost, security, compatibility, and migration criteria.

Data engineering architect presenting a python code bundle and stored procedure architecture comparison to technology leaders

Executive summary

Snowflake’s Code Bundles let teams package and execute Python projects on Snowflake compute without wrapping every script in a stored procedure. That can simplify a multi-file ETL application that already consists of Python modules, shared utilities, a requirements file, and an entrypoint. But it is not a universal replacement for procedures, and the word ‘warehouse’ does not mean any Python application will run efficiently there.

A practical default is to use warehouse Code Bundles for bounded Python batch jobs whose heavy work is pushed into Snowflake SQL or Snowpark, retain stored procedures for stable reusable database operations and SQL CALL contracts, and consider compute pools or external infrastructure when substantial work occurs in Python memory or needs specialized dependencies. Because warehouse execution remains in Public Preview, production adoption needs explicit governance and a fallback.

The objective is lower engineering friction and reliable business outcomes, not adoption of the newest execution feature.

What Snowflake introduced

On 24 September 2026, Snowflake expanded Code Bundles with Python execution on virtual warehouses. A bundle is a named package of source files, with a code_bundle.yml specification describing language, compute type, runtime version, dependencies, and optional access configuration. It can be created from a workspace or stage and executed at a selected entrypoint. Snowflake injects an active Snowpark session so the code can access warehouse data without managing separate connection credentials in the script.

The feature also supports orchestration through Snowflake Tasks or external clients. A version represents an immutable snapshot of bundle files, which can help release management. Snowflake’s Code Bundles documentation distinguishes generally available notebook scheduling on compute pools from warehouse execution and other newer features in Public Preview. That distinction matters for service-level commitments.

Four patterns to compare

Python stored procedure: a callable database object, useful for a reusable action with defined parameters, a return contract, and established database security behavior. It may be invoked by SQL, an application, or a Task. Procedures can use staged handler code and dependencies; they are not necessarily limited to a single inline file.

Warehouse Code Bundle: a project-shaped job with an entrypoint, runtime specification, and potentially multiple Python modules. This fits batch orchestration, validations, and transformations where expensive operations execute in Snowflake rather than in the local Python process.

Compute-pool Code Bundle: an execution environment based on Snowpark Container Services. This is more suitable for Python-heavy processing, specialized runtimes, custom containers, or GPU-oriented work. It introduces a different compute and operations model.

Data architects comparing stored procedures, warehouse Code Bundles, compute pools, and external Python execution patterns

External Python execution: a VM, managed job service, container platform, or orchestration worker that connects to Snowflake. This can be appropriate when the application integrates many systems, requires independent scaling, or must run under an external operational boundary.

None of these choices is inherently superior. Choose the smallest dependable architecture that meets the business requirement and is supportable by the team.

When a Code Bundle makes engineering simpler

The strongest candidate is an existing Python repository with main.py, transformations.py, validation.py, a dependency manifest, tests, and a deployment pipeline. If engineers currently have to reshape this project into one or several stored procedure handlers solely to execute it near Snowflake data, Code Bundles may preserve the natural code structure and reduce bespoke packaging work.

Software engineer reviewing a multi file python project with modules, dependencies, and deployment files

For example, an overnight finance preparation job might validate that all input feeds arrived, invoke a set-based SQL MERGE, calculate row-count and value reconciliations, write an audit result, and publish an approved batch marker. Python coordinates these stages, while Snowflake handles the joins and aggregations. This is an illustrative design, not a claim about a client implementation.

Another candidate is a scheduled data-quality check that shares common validation libraries with other projects. Rather than duplicate helper code across procedure definitions, the team can package and test a cohesive application. The benefit is maintainability only if deployment, version pinning, observability, and rollback are implemented properly.

These considerations connect to the broader work of data integration and modeling. Actiknow’s business intelligence services describe solution architecture, integration from databases and APIs, modeling, reporting, and refresh design. The execution mechanism should serve that architecture rather than dictate it.

When a stored procedure is the better fit

Keep a stored procedure when the job is a compact, reusable database operation with a stable CALL signature. An application that needs to invoke ‘validate invoice’, ‘refresh customer summary’, or ‘close accounting period’ may benefit from a well-defined routine rather than an entire packaged batch application.

Procedures also provide established execution-rights options. Owner’s-rights and caller’s-rights choices affect which data a routine can access and how permissions are delegated. These security semantics must be evaluated deliberately; a Code Bundle should not be assumed to reproduce them exactly.

If an existing procedure is correct, monitored, inexpensive, and easy to deploy, migration has to earn its place. The engineering effort, new release process, Preview risk, and support training may exceed any benefit. Snowflake’s stored procedures overview explains their database-oriented role and execution model.

Decision criteria: six questions before choosing

  1. Is the workload a database operation or a project-shaped batch? If it has a narrow callable contract, lean toward a procedure. If it has several modules, validation stages, and CLI-style parameters, evaluate a bundle.
  2. Where does the expensive work happen? SQL and Snowpark pushdown favor warehouse execution. CPU-intensive loops, large in-memory dataframes, or specialized Python libraries may favor a compute pool or external runtime.
  3. How are releases managed? Compare the effort to review, package, promote, version, and roll back each option. A bundle helps only when the project and CI/CD process actually benefit from being deployed together.
  4. Which security boundary is required? Confirm execution identity, object privileges, secrets, network access, and the ability to audit changes. Do not migrate an owner-rights procedure without analyzing its permission contract.
  5. What service level is required? A nightly batch may tolerate variable startup and retry behavior. A customer-facing request path may need a separate low-latency application architecture.
  6. Is Preview exposure acceptable? Some organizations allow Preview in a sandbox or noncritical pipeline but prohibit it for regulated or revenue-critical processing. Obtain an explicit decision before rollout.

A minimal warehouse Code Bundle

A simple project can contain main.py and code_bundle.yml. The following example mirrors Snowflake’s documented pattern and is intended for a non-production proof of concept. Replace the workspace, warehouse, database, and schema with your approved resources.

code_bundle.yml

bundle:

  type: custom

  compute_type: warehouse

  language: python

  compute_options:

    runtime_version: ‘3.11’

main.py

from snowflake.snowpark.context import get_active_session

session = get_active_session()

result = session.sql(‘SELECT CURRENT_TIMESTAMP() AS RUN_TS’).collect()

print(result[0][0])

Example invocation after CREATE CODE BUNDLE from an approved source:

USE WAREHOUSE ETL_WH;

EXECUTE CODE BUNDLE FINANCE_BATCH ENTRYPOINT = ‘main.py’;

The session’s active warehouse is the execution target for a warehouse bundle. The actual CREATE CODE BUNDLE command needs a valid workspace or stage source. Production code should avoid relying on implicit database or schema context and should use fully qualified names where appropriate.

Dependency management and reproducibility

The code_bundle.yml reference documents runtime versions, requirements files, artifact repositories, secrets, external access integrations, and stage mounts. Pin the Python version as a quoted YAML string. Pin dependencies where practical and verify transitive versions. A package that works on a developer laptop is not evidence that the same package is supported by the warehouse execution environment.

Treat source commit, bundle version, dependency lock or requirements file, and execution configuration as one release record. Run automated tests before promotion, deploy using a dedicated identity, and preserve the previous approved version. Avoid mutable production artifacts that can be changed without review.

A useful deployment gate checks syntax, package resolution, data permissions, output schema, business reconciliations, and recovery. Include an independent verification that the code version executed is the version approved in change control.

Security: data locality is not permission governance

Snowflake documents CREATE CODE BUNDLE on the schema for creation, and USAGE or OWNERSHIP on the bundle for execution. The runtime identity also needs appropriate access to the warehouse and data it processes. Separate deployment privileges from ordinary execution, and do not use a shared administrator role for all jobs.

Use a least-privilege role tied to the workload. Test access to sensitive tables, masking and row-access policies under that role. Review the Task owner’s permissions if Tasks trigger execution. Keep API tokens out of source files, YAML values, and logs; use Snowflake-supported secrets and external access integrations when required.

Cloud security architect and Snowflake platform administrator reviewing execution roles, data permissions, and access controls

Check runtime-specific constraints before assuming files or network operations will work. For example, the documentation distinguishes stage mounts on warehouses, which are read-only, from mounts on compute pools that can be read/write. A design that depends on writing local files to a mounted stage must account for this.

Cost: compare complete workloads

Running Python on warehouse compute still consumes compute capacity. It can extend warehouse uptime, affect other queries, or require a different warehouse size. A fair benchmark compares total credits per successfully completed batch, elapsed time, p95 duration, retries, queueing, external infrastructure, and support effort.

Finance analyst and data engineering manager comparing snowflake warehouse credits, execution time, and batch processing costs

Suppose a team compares an existing procedure-based job with a Code Bundle on matched daily input snapshots. It should keep transformation logic and correctness requirements equivalent, then measure ten or more representative runs including one high-volume period. The relevant number is not merely seconds per query: it is the total operating cost of delivering correct data by the required deadline.

Workload isolation may be justified if a new job competes with executive dashboards. A smaller warehouse that runs longer is not always cheaper, and a shared warehouse may obscure job-level economics. The Snowflake cost optimization checklist offers a broader framework for warehouse sizing, idle compute, credit monitoring, and ownership.

Correctness, idempotency, and auditability

Changing execution packaging must not change financial or operational outputs. Compare the old and new paths at an agreed grain. Test row counts, control totals, null handling, deduplication, timezones, late-arriving records, deletes, and representative edge cases. Set tolerances explicitly, especially for floating-point or timestamp behavior.

Design for replay. If a run fails after writing a target table but before recording success, rerunning it must not duplicate records or silently overwrite newer data. Prefer stable batch identifiers, transactional boundaries where available, deterministic MERGE keys, and a durable run ledger.

The run ledger should record input batch, code version, execution identity, start and end times, source and target counts, key totals, query identifiers, error state, and the operator who approved any manual intervention. A green infrastructure status is not a substitute for a successful business reconciliation.

Monitoring and failure recovery

Monitor failures, run duration, retries, missed data freshness deadlines, unusual row counts, and warehouse contention. Tie alerts to business service levels. A job that finishes successfully after an executive reporting deadline is operationally late, even if the execution system reports success.

Test five failure modes before launch: a missing dependency, a revoked permission, a warehouse timeout or contention event, a partial output write, and an upstream schema change. For each, verify that the failure is visible, the downstream report does not silently accept bad data, and the recovery runbook identifies an owner and safe next action.

Rollback must cover both code and data. Restoring the prior bundle version is insufficient if a failed run already modified target tables. Maintain a tested data replay or restore procedure, and confirm that dashboards and dependent jobs are correct after recovery.

Four-week implementation pilot

Week 1: Select a low-risk

bounded Python batch with clear inputs, outputs, ownership, and historical performance. Document the current procedure or external job, runtime, dependencies, permissions, cost, recovery method, and business deadline. Confirm that the Preview feature is permitted for this workload.

Week 2

Package the same logic into a Code Bundle in a non-production environment. Configure a dedicated warehouse and role, pin dependencies, implement a run ledger, and deploy from source control. Test repeatable installation and rollback.

Week 3

Execute both implementations on matched snapshots. Reconcile outputs and measure runtime, credits, retries, and support overhead. Deliberately interrupt the new job, simulate a permission failure, and test idempotent replay.

Week 4

Review results with the platform team, security, data engineering, finance, and the business owner. Approve limited rollout only if correctness, security, recovery, and service-level criteria pass. Otherwise retain the current pattern and document the reason. A pilot that concludes ‘do not migrate yet’ can still prevent an expensive architectural mistake.

Data platform and engineering team reviewing a four week snowflake code bundle pilot, test results, and production rollout checklist

Executive acceptance checklist

Business parity: outputs reconcile to agreed controls. Reliability: the job meets deadlines under representative concurrency. Security: deployment and execution roles are separately reviewed. Cost: total credits per completed batch are measured. Maintainability: the release is reproducible and can be rolled back. Recovery: partial writes and replay are tested. Governance: the organization accepts the feature’s current availability status.

Treat correctness and security as gates, not points in a weighted average. A cheap job that silently changes a finance metric is not an optimization.

Mistakes to avoid

Do not convert every procedure into a bundle simply to standardize on Python. Do not move CPU-heavy Python to a warehouse without testing where computation occurs. Do not assume an injected Snowpark session eliminates privilege design. Do not equate a packaged release with a tested release. Do not compare a tuned new implementation with an intentionally neglected old one.

Avoid deploying to a generic shared warehouse with no workload owner, and do not publish mutable artifacts directly from a developer’s workspace into production. The simplest architecture is the one that the organization can explain, observe, repair, and evolve.

Frequently asked questions

1. What is Snowflake Python warehouse compute?

It is the ability to execute Python Code Bundles on Snowflake virtual warehouses. The feature is in Public Preview as of 10 November 2026.

2. Do Code Bundles replace stored procedures?

No. Bundles are useful for packaged jobs; procedures remain valuable for callable database routines and established SQL interfaces.

3. Can an existing Python project be reused?

Often, yes, especially if it has ordinary modules and an entrypoint. Validate library support, packaging, runtime behavior, and data access.

4. Does a Code Bundle require separate Snowflake credentials?

Snowflake can inject an active Snowpark session. The executing role still needs the appropriate warehouse and object permissions.

5. Are warehouse Code Bundles generally available?

No. Snowflake currently documents warehouse execution as Public Preview. Check current status before production approval.

6. When should we use a compute pool instead?

Consider it when the workload needs intensive Python-side computation, specialized runtime dependencies, or GPU resources.

7. Can Tasks invoke Code Bundles?

Yes, Snowflake documents Task-based orchestration, but the Task role, warehouse, scheduling, and recovery must be configured.

8. How are dependencies installed?

The bundle specification can reference a requirements file and artifact repositories. Test exact versions on the chosen runtime.

9. How should costs be compared?

Measure credits, runtime, retries, contention, and support effort per successfully completed business batch, not only a single query.

10. Can we roll back a bundle?

Versioned bundles support a release rollback strategy, but you also need a safe data replay or restoration procedure.

11. Are bundles appropriate for real-time APIs?

Not automatically. Evaluate latency, concurrency, availability, and independent application scaling before using batch execution for serving.

12. What is the first decision for a CTO?

Approve one bounded pilot with explicit correctness, cost, security, and recovery criteria, rather than a platform-wide migration.

Conclusion

Snowflake Code Bundles can make project-shaped Python ETL easier to package and execute near warehouse data. The strongest candidates are jobs that already have a coherent Python codebase and push their heavy processing into Snowflake. Stored procedures still offer an effective contract for reusable database operations, while compute pools and external runtimes remain better for other workloads.

Choose by execution semantics, team capability, cost, governance, and recovery. Validate the Preview capability in a controlled environment and promote only after measured evidence shows that the new pattern is simpler without compromising business correctness.

Discuss your Snowflake architecture

Actiknow provides data integration, BI implementation, custom solutions, and automation services. If your team is evaluating Python job packaging, warehouse workload design, or a migration pilot, contact Actiknow to discuss the architecture and acceptance criteria. A representative workload and its operational constraints are the right starting point.