Amazon Redshift Python UDF end of support: your options

Redshift stops supporting Python UDFs after June 30, 2026. This page compares rewriting the logic as SQL or Lambda UDFs on Redshift with moving it to ClickHouse or Trino, and explains when the rewrite is the moment to leave.

On this page

Amazon Redshift Python UDF end of support: what it forces you to decide

Python UDFs in Redshift stop being supported after June 30, 2026, so any warehouse logic written in Python has to be rewritten or moved before that cutoff. The short answer: keep the logic on Redshift only if it can be rewritten as SQL or Lambda UDFs at an effort your team can accept, and move it to a self-hosted engine when the Python code is the main reason the warehouse is hard to run, test or change. Start by inventorying every Python UDF, the schemas and users that call it, and the scheduled jobs and BI dashboards that depend on it.

The supplied research does not include AWS's own deprecation notice, so confirm the exact cutoff dates, affected runtimes and any exceptions in the AWS Redshift documentation and in your own account's console before you plan. Check which UDFs are scalar and which are used inside stored procedures or materialized views, because the rewrite effort differs. Also check whether each function does simple transformation that SQL can express, calls external services, or depends on Python libraries, since libraries and network calls are the usual reasons a rewrite becomes a project of its own.

The decision is also a cost decision. A rewrite to SQL or Lambda UDFs keeps the workload on Redshift billing, which you already understand, but leaves the same warehouse in place. Moving to ClickHouse or Trino means new compute, a data export path such as Redshift UNLOAD guidance, testing and recurring operations work. Ask for a written scope that separates UDF rewrites, data movement, query translation and operations so you can compare the two paths on equal terms.

What the end of support requires from your UDF code

The June 30, 2026 cutoff turns each Python UDF into a migration item with an owner and a test plan. The cards below cover what to produce before choosing a replacement, so the decision rests on evidence from your own warehouse rather than on the function names alone.

Inventory every UDF and its callers

List each Python UDF in every database and schema, then trace the views, stored procedures, scheduled queries and pipelines that call it. Include jobs in orchestration tools and BI dashboards, since they are the callers most often missed. The output is a register with the function name, its signature, its callers and the team that runs each caller. Without this register, you cannot tell how much breaks when the functions stop working.

Redshift pricing

Capture a behavior baseline

Record the current outputs of each UDF on a representative sample of production inputs before anything changes. Store the inputs and outputs with their row counts and timestamps so the same comparison can run later. Note any outputs that depend on library versions, locale, rounding or random seeds, because those are the results a rewrite most often changes without anyone noticing.

Decide Lambda or SQL replacement per function

For each function, choose whether the logic becomes a SQL expression, a Lambda UDF on Redshift, or code that moves out of the warehouse entirely. Record the reason for each choice, such as latency, external calls, or the cost of moving data across the boundary. Confirm current Lambda UDF behavior, limits and supported runtimes in the Redshift documentation before you commit to that path.

Build test data for edge cases

Assemble a test set that includes nulls, empty strings, out-of-range numbers, unusual character encodings, timezone boundaries and very large values. Run the baseline inputs and these edge cases through both the old and new logic. Differences in null handling and type coercion account for many silent errors after a UDF rewrite, so treat each difference as a defect until a reviewer accepts it.

Assign an owner to each changed function

Name one accountable person for every function that changes, along with a reviewer who did not write the replacement. The owner signs off on the baseline comparison, the edge-case results and the rollout date for that function. Ownership also covers callers that depend on the function's output, so the people who run dashboards and pipelines are informed before the switch.

Which replacement path fits your Python UDF logic

This table compares four ways to replace Python logic that runs inside Redshift, from staying on Redshift to moving the computation out. Read each row for where the logic lives after the change, what the team must own, and the trade-offs that decide the choice. The main takeaway is that a SQL rewrite keeps the warehouse model intact, while ClickHouse or Trino paths change the platform and need a proof of concept before commitment.

PathWhere the logic runsWhat the team needsTrade-offs
Rewrite as a Redshift SQL UDFInside Redshift, as SQL functionsSQL skills and a review of each function's logic against test dataKeeps the warehouse unchanged, but logic that depends on Python libraries or complex control flow may not translate cleanly
Keep the logic as a Lambda UDF on RedshiftOutside Redshift, in an AWS Lambda function called from queriesAWS Lambda code ownership, IAM roles, networking and monitoring for each functionPreserves Python behavior, but adds AWS dependency, per-call latency and a second runtime to operate and secure
Move computation to ClickHouse executable UDFsInside ClickHouse, through executable UDFs that run external programsConfirm language support, data type mapping and performance in the ClickHouse documentation and a proof of conceptRequires the platform move itself; internals are not covered by the facts supplied for this page, so verify before planning
Move transformation to Trino functions or an external processing stepIn Trino's function layer or in a separate job or service outside the query engineConfirm available functions and extension options in Trino's documentation, plus a separate pipeline owner for external stepsSuits teams already querying a lakehouse, but Trino queries data where it lives and does not store the transformed output itself
Decide when the rewrite is the moment to leaveDepends on how much Python logic remains after inventoryAn inventory of each UDF with its inputs, outputs, libraries and callersIf most logic needs Python, a platform move may cost less than repeated workarounds; if little does, a SQL rewrite on Redshift is often enough

Stay on Redshift or leave, by situation

Small UDFs that compute a value from scalar inputs, such as string cleanup, rounding or a date bucket, often translate into plain SQL or a CASE expression. This is usually the cheapest case. Staying on Redshift with a SQL rewrite keeps the logic where the queries and permissions already live. If you are migrating anyway, ClickHouse has built-in functions for most scalar operations, but function names, NULL handling and type coercion differ, so the mapping needs checking rather than assumption.

  • Pure functions: UDFs with no I/O and no state rewrite directly. Confirm they are deterministic and check how they treat NULL inputs.
  • Built-in coverage: Confirm that each function has a native equivalent on your target platform. Finding those equivalents is most of the work.
  • Call-site inventory: Find every query, view and stored procedure that calls the UDF, including ad hoc analyst SQL.
  • Edge-case drift: Compare output on floating-point values, timezone-sensitive timestamps and empty strings, where small differences often appear.

Test first by running the old and new functions side by side on a sample of production inputs and comparing results row by row.

When the rewrite is the moment to leave Redshift

The rewrite is a natural decision point because the team is already changing code, tests and data flows anyway. Once the Python logic has to move, the real question is whether it should stay inside Redshift at all. Leaving makes the most sense in three cases: the UDF logic also needs data that sits outside Redshift, the team already plans to unload data for other reasons, or the Python code depends on libraries that are hard to reproduce in SQL. If one or more of these apply, a rewrite on Redshift adds work that you may repeat later, so compare the two paths before committing engineering time.

Before deciding, unload a representative sample to S3. UNLOAD is the common exit path from Redshift, and it lets you test both options against real data without changing production. Confirm which data types your tables use, since some only unload cleanly as text, and check the file format and partitioning you would need for the target engine. Also list every UDF with its inputs, outputs, third-party dependencies and call volume, so you can see which ones are simple expressions and which carry real logic. The Redshift export guide is not the right source for export mechanics; use the export topic on this site for those details.

Then read the sibling migration topics to compare the destinations. The migration to ClickHouse covers executable UDFs and schema redesign, and the migration to Trino covers registering unloaded files as Iceberg or Hive tables and replacing Redshift workload management. Choose the destination that matches your workload, and plan a retest of every converted function against the original output before cutover. If your team cannot yet say which libraries the Python code needs, that inventory is the first task to finish, because it sets the scope of any option.

Decision path for each Python UDF

Start at one item from the Python UDF inventory and ask whether the logic can be written as SQL on Redshift. If not, check whether it needs an external call that a Lambda UDF can serve. Logic that needs data or a workload outside Redshift points toward ClickHouse or Trino, and the planned data unload decides which of those two fits. Treat the result as a planning aid: confirm each branch against your own functions, data volumes and Redshift release notes before committing to a rewrite.

Planning aid for routing each Python UDF to one of four outcomes.

How to move Python logic to self-hosted ClickHouse or Trino

The sequence moves your tables and Python-dependent logic out of Redshift in an order that keeps a known-good baseline to compare against, so cutover is a decision backed by evidence rather than a hope.

  1. Inventory every Python UDF and its callers

    Query the Redshift system catalog for every user-defined function, then trace each one to the views, stored procedures, scheduled queries and BI dashboards that call it. Record the input and output types, the Python libraries each function imports, and any external calls it makes. The output is a register with one row per function and its dependents, reviewed by the data team that owns the logic. Confirm the exact catalog views and the support timetable for your Redshift version in the AWS documentation before you start, since the end-of-support date sets the deadline for the whole sequence.

  2. Unload source tables to S3 as Parquet

    Run UNLOAD against each source table to an S3 prefix in Parquet format, keeping a manifest so the load can be verified file by file. Partition the output where the table is large, and encrypt it with a key your security team controls. Compare row counts and a checksum of key columns between Redshift and the unloaded files. Data types that only unload to text need a conversion rule written down in the register. The output is a complete, verified copy of the data in your own bucket, which also serves as the exit path if the migration stops partway.

  3. Stand up a pre-production target with representative data

    Build a non-production ClickHouse or Trino environment in your own infrastructure, load the unloaded data, and replay a sample of real queries and dashboard workloads against it. For ClickHouse, load the data with the s3 table function. For Trino, register the Parquet files as Iceberg or Hive tables. Keep the pre-production environment separate from production identity, keys and networks. The output is a loaded environment and a list of queries that run without errors, along with the ones that do not.

  4. Configure resilience and access for the chosen engine

    For ClickHouse, create ReplicatedMergeTree tables and run ClickHouse Keeper with at least three Keeper nodes on dedicated hosts, then set up BACKUP and RESTORE to S3-compatible storage on a schedule. For Trino, run the coordinator and workers on a 64-bit Linux system with a 64-bit Java 25 runtime (minimum 25.0.1), configure the Iceberg catalog against Hive Metastore, AWS Glue or an Iceberg REST catalog, and choose the access control method: file-based rules, Apache Ranger or Open Policy Agent. Confirm the authentication mechanism with your identity team. The output is a running cluster with documented access rules and a restore test that has succeeded at least once.

  5. Reimplement or relocate each UDF

    Work through the register and decide, per function, whether it becomes a SQL expression, a Redshift Lambda UDF that remains available during the transition, a ClickHouse executable UDF, or a Trino function or pipeline step outside the query engine. Pure arithmetic and string logic usually converts to SQL. Functions that depend on specific Python libraries need a decision about where those libraries run. Each reimplemented function should have unit tests that use the inputs captured in the register. The output is a versioned set of functions in the target engine and a mapping table from each old UDF to its replacement.

  6. Check outputs against the captured baseline

    Run the same inputs through the original Redshift Python UDFs and the new implementations, and compare results row by row, including nulls, rounding, time zones and error behavior. Record every difference, decide whether it is a defect or an accepted change, and fix the defects. Trino's Redshift connector can read from Redshift during this period, so the team can run joins across both systems and find mismatches without copying more data. The output is a signed-off comparison report covering each function and each dependent view, with no unexplained differences.

  7. Cut over dependents and keep the exit open

    Repoint dashboards, scheduled jobs and applications to the new engine in groups, starting with the lowest-risk reports. Keep Redshift read-only and retain the S3 unload until the new environment has run through the agreed monitoring period and a restore test has passed. Review the ClickHouse release policy or Trino release notes for the version you deploy, and schedule upgrades with a pre-production run each time. The output is a cutover log showing each dependent moved, the rollback point for each group, and the date Redshift is decommissioned after sign-off.

Evidence that the migrated UDF logic behaves the same

After a Python UDF is rewritten, internal audit and change reviewers usually want proof that the new logic matches the old, that the platform is recoverable, and that changes were controlled. The cards below cover the records to collect before cutover. DeployOpen prepares this evidence for your environment, but independent auditors and certification bodies are the ones who assess and certify it.

UDF inventory with owners

List every Python UDF on the Redshift cluster with its name, signature, input and output types, the tables and views that call it, and a named business owner. Reviewers use this list to confirm that no function was left out of the migration. Check the list against catalog queries on the live cluster, not against memory or old tickets, and record which UDFs are retired instead of rewritten.

Redshift pricing page

Baseline outputs and comparison results

Capture outputs from the Redshift Python UDFs on a fixed, representative input set before any change, then run the same inputs through the rewritten SQL, ClickHouse executable UDF or Trino function. Store both result sets and the diff report. Include edge cases such as nulls, rounding, time zones and malformed strings, since those are where rewrites usually drift.

Test restore on a spare cluster

For the self-hosted ClickHouse target, run BACKUP and RESTORE of the migrated tables on a spare cluster and record the result. ClickHouse documentation warns that a backup never test-restored will probably not restore properly when needed. Keep the restore log, row counts and checksums, and note that replication alone does not protect against human error or corruption.

ClickHouse backup docs

Changelog review for the chosen release

Record which ClickHouse or Trino release the UDF logic was tested against and the changelog review for that version. ClickHouse advises reading the changelog before upgrading because minor backward-incompatible changes can occur. Confirm that the version is in the vendor's supported list at the time of sign-off, and note the planned upgrade path for security fixes.

ClickHouse production FAQ

Access control configuration

Export the user, role and grant configuration that governs who can call the migrated functions and read the underlying tables. Document the chosen authenticator, such as LDAP, Kerberos, certificates or JWT for ClickHouse, or the equivalent for Trino, plus the access control method. Reviewers compare this export against the access rules that existed on Redshift, so gaps show up here first.

ClickHouse access control docs

Cutover change log

Keep a dated record of each step in the cutover: who approved it, what changed, the rollback point and the result of the parallel run. Reviewers use this log to trace any production difference back to a specific change. Include the decision to retire each Redshift UDF, because the record of what was removed is often the first thing an auditor requests.

What teams ask before rewriting Redshift Python UDFs

How much effort does rewriting Redshift Python UDFs take?

The effort depends on how many UDFs exist, how much logic each one holds, and whether that logic can be expressed in SQL at all. A short inventory is the first step: list every Python UDF, its inputs and outputs, the queries and views that call it, and the jobs that depend on it. Teams with a handful of simple string or date functions usually finish far faster than teams with UDFs that call external libraries, parse documents or hold business rules. Ask any partner for a written inventory step before a quote, because the count and complexity of the functions set most of the scope.

Can SQL UDFs replace the Python code in Redshift?

Some can and some cannot. Logic made of arithmetic, conditionals, string handling and joins typically translates to a SQL UDF or a plain query expression with little loss. Logic that depends on Python libraries, regular expressions with complex state, JSON handling beyond what SQL offers, or statistical functions usually needs a different home, such as a Lambda UDF, a transformation step in your pipeline, or an application service. Classify each function into these groups during the inventory so the rewrite is planned by category instead of one function at a time.

When are Lambda UDFs the better fit than SQL UDFs?

Lambda UDFs suit logic that needs a full programming runtime or external calls, and that can tolerate the latency and invocation model of a remote function. They also let you keep existing code in a service you already operate. The trade-offs are operational: you own the function code, its permissions, its concurrency and its failure handling, and each call adds network latency that grows with row counts. Confirm current Lambda UDF limits and supported runtimes in the Redshift documentation before choosing this path for high-volume queries.

Can our own engineers do the rewrite without outside help?

Often yes, if the team already knows SQL, the warehouse, and the source code of the UDFs, and if the inventory is small. Outside help is more useful when the Python logic is poorly documented, when results must match old outputs exactly for audit or reporting, or when the same people must also run a migration to a new engine. Your own team will still need time for testing and cutover, so ask any provider to separate advisory, implementation, and testing in a written scope so you can decide which parts to keep in-house.

How long does the work take, and what sets that time?

No duration can be stated here without a inventory, so treat any early estimate with caution. The main drivers are the number of UDFs, the share that needs a new runtime, the number of dependent queries and dashboards, the volume of data that must be compared between old and new outputs, and how many environments must be validated. Ask for milestones tied to the inventory, the rewrite, the parallel comparison and the cutover, and for each milestone to name its own exit criteria.

What does the work need from our side?

You need named owners for the UDF code and the downstream reports, read access to the Redshift cluster and its query history, a test environment with representative data, and a decision-maker who can accept output differences. Security and platform teams should review any Lambda permissions, network paths and secrets. Budget internal time for these roles from the start, since missing owners are a common reason rewrites slip.

Should we move the UDF logic to ClickHouse or Trino instead?

Choose the target by where the workload runs and how queries use the data, not by the UDF alone. ClickHouse suits fast analytical queries on large event tables and supports executable UDFs, which can run external programs, but those need their own operation and testing. Trino suits querying files in S3 through Iceberg or Hive tables and offers a broad function library plus the ability to query Redshift during transition. If the Python logic is the main reason to leave, confirm each function's behavior on the target engine with your own test data before committing. Compare this with the Redshift migration guide for ClickHouse and your Trino plan.

How DeployOpen works on this

DeployOpen starts by inventorying the Python UDFs in your Redshift estate and deciding, function by function, whether each one moves to SQL, a Lambda UDF, or a self-hosted engine. The work is planned and deployed inside your own AWS accounts or data centers, with the migration path agreed before any code changes.

How we scope

  • The written scope lists every Python UDF, its callers, and the rewrite target chosen for each one.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
  • Scope also covers the BI tools, stored procedures and scheduled jobs that call the functions.

How we build

  • Rewrites are tested against representative data and query results from your current Redshift cluster.
  • If you choose ClickHouse or Trino, the target is deployed in your infrastructure with SSO, access control and audit logging.
  • Security testing covers function permissions, credential handling and data exposure for each rewritten component.

How we hand over

  • You receive the inventory, rewrite decisions, test evidence and runbooks for each function in the scope.
  • Restore tests for the new backup setup are run and documented, so the handover shows recovery was exercised.
  • Documentation is written so your own engineers can operate and change the functions after handover.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Retainers can cover ClickHouse or Trino version upgrades, tracked against the vendor's supported release list.
  • Support scope and response expectations are written into the retainer agreement, which you should review before signing.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.